In Excel, I have used;
strFilePath = Application.GetOpenFilename("Excel Files (*.xls),*.xls")
or....
Function File_2_Open() As String
Dim strVar As Variant
On Error Resume Next
strVar = Application.GetOpenFilename("Excel Files (*.xls),*.xls")
Workbooks.Open strVar
' deal with it... your code here...
File_2_Open = strVar
End Function
or...
Check this out:
http://www.mvps.org/access/api/api0001.htm
and bookmark that site!
-Tom.
Microsoft Access MVP
Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.Show
MsgBox "file choose was " & f.SelectedItems(1)
above needs: Microsoft Object 11.0 Object library
If you remove the reference to the 11.0 object library, then the following
code will work without any references:
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
f.Show
MsgBox "file choosen = " & f.SelectedItems.Count
Note that above also works in runtime. So:
Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.Filters.Add "Excel Files (*.xls)", "*.xls"
f.Show
MsgBox "file choose was " & f.SelectedItems(1)
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOO...@msn.com