i saw this topic How to show "Open File" Dialog in Access 2007 VBA? and i like the solution there that’s not using references, however, i can’t figure out how to display the file path that the user selected. can someone please explain
thank you very much
this is the piece i’m talking about
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
f.Show
MsgBox "file choosen = " & f.SelectedItems.Count
First things first: you should always prefer to use strongly-typed variables whenever possible. In this case, you can replace
ObjectwithOffice.FileDialog.To display the paths of each file that was selected, you need to loop through the
SelectedItemscollection. For example, you would add the following code:Note that the
FileDialogalso has other properties that you can set, if you require customization. For example, the.Titleproperty allows you to specify a title that will appear as the dialog’s caption in the title bar. You can also specify a filter using the.Filterproperty, which will limit the type of files that the user will be able to see and choose from in the dialog. For example, if you wanted to limit the choices to only Access Databases, you could add the following code: