[Solved] Don’t know how program a button to open file explorer that can open any document


Someone else was able to answer my question on another forum. Credit goes to Trebor76 from Ozgrid for the user friendly solution. This is the solution that was given to me. This was pretty plug and play.

Option Explicit
Sub Acessdocumentexplorer_Click()

    'The following has been adapted from here:
    'https://msdn.microsoft.com/en-us/vba/excel-vba/articles/application-
filedialog-property-excel

    Dim lngCount As Long

    'Open the file dialog
    With Application.FileDialog(msoFileDialogOpen)
        .AllowMultiSelect = True
        .Show
        'Display paths of each file selected
        For lngCount = 1 To .SelectedItems.Count
            'MsgBox .SelectedItems(lngCount)
            CreateObject("Shell.Application").ShellExecute 
.SelectedItems(lngCount)
        Next lngCount
    End With

End Sub

Just as I needed all this code does is Simply open the file explorer when I click on the “Access Document Explorer” button that I have on my worksheet. From there it has the capability of opening any document/program I need opened/run.

Ozgrid forum Link

solved Don’t know how program a button to open file explorer that can open any document