Christopher Greaves |
|||
Christopher Greaves |
|||
If you are interested in applications please visit www.VBASolutions.ca .
If you are interested in end-user macros please visit www.TorontoMacros.com .
It returns the user’s chosen file name, or an empty string in the event that the user cancelled the dialog box.
I can never remember the composition of a filter, so I wrote a small helper function, “”, which returns a sample filter.
Try adjusting the string to return, say, Excel workbook files.
Dim strFilter As String
strFilter = UW.Browsers.strSampleFilter
Debug.Print strFilter
strFilter = "Word Template Files (*.dot)" + Chr$(0) + "*.dot" + Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
MsgBox UW.Browsers.strBrowseFile2("Please select a file", strFilter, "C:")
Dim strFilterXLS As String
strFilterXLS = "Excel Workbook Files (*.XLS)" + Chr$(0) + "*.xls" + Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
Debug.Print strFilterXLS
MsgBox UW.Browsers.strBrowseFile2("Please select a file", strFilterXLS, "C:")
End Sub