I have this line of code which imports an Excel file into a table via VBA code.
It works fine as long as the Excel file name is always the same because the saved import is always looking for that file name. But the Excel file name will always be different even though the structure of the file will always be the same.
The user is selecting the Excel file via:
Dim fd As FileDialog, SelectFolderOrFile
Set fd = Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = Environ("userprofile") & "\Documents\"
If .Show Then
Me.txtFileName = .SelectedItems(1)
My question is this... what can I replace the code...
with that will accept the file name, no matter what it is?