Code: Select all
Dim strFile As String
Dim fDialog As Office.FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
' Allow user to make multiple selections in dialog box
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Please select CURRENT file."
' Clear out the current filters, and add our own.
.Filters.Clear
' .Filters.Add "Access Databases", "*.MDB"
' .Filters.Add "Access Projects", "*.ADP"
.Filters.Add "Excel Files", "*.xls"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
strFile = .SelectedItems(1)
Else
MsgBox "You clicked Cancel in the file dialog box."
GoTo Exit_cmd_Update_FromTAC_Click:
End If
End With
' strip out the path and file name as separate strings
Ken