I have found code for this but have only found code that specifies excel files not one that allows me to open any document. Basically I have a button on a work sheet that needs to open a file explorer when clicked on. Once it has been clicked on it needs to direct the user to a specific file path that contains documents of various types. The user should then be able to open any of the documents. Does anyone have a solution for this?
Thanks in advance!
Here is what I have so far from what I have found elswhere...
Private Sub Showfileexplorer_Click
Dim strFileToOpen As String
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xlsx* (*.xlsx*),")
If strFileToOpen = False Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Workbooks.Open Filename:=strFileToOpen
End If
End Sub
This code works to the point of choosing a document. I have tried picking the document I wanted (Specifically excel.xlsx files as is listed above) to open and then clicking open and it throws me an error. The thing is I don't want just excel files. If it could open any file that would be great.