Christopher Greaves

Contact Me

ON LINE STORE

ON LINE STORE

ON LINE STORE

ON LINE STORE

Building and Maintaining Excel Libraries

If you are interested in applications please visit www.VBASolutions.ca .

If you are interested in end-user macros please visit www.TorontoMacros.com .

Browsers

This function takes a string argument which will appear as the title and an optional second parameter as a filter string.

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.

Sub TESTstrBrowseFile()

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

Contact Me