Dim fDialog As Office.FileDialog Dim varFile As Variant Dim Path As String ' Set up the File Dialog. Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog fDialog.AllowMultiSelect = False fDialog.Title = "Please Select An Excel Sheet" Clear out the current filters, and add our own. fDialog.Filters.Clear fDialog.Filters.Add "Excel Sheets 2003", "*.xls" fDialog.Filters.Add "Excel Sheets 2007", "*.xlsx" '.Filters.Add "All Files", "*.*" ' 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 fDialog.Show = True Then Path = fDialog.InitialFileName 'Importing the Data From Excel Sheet to access database
Path = fDialog.InitialFileName
InitialFileName
FileDialog.SelectedItems
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)