Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show "Open File" Dialog

Tags:

vba

ms-access

How would I go about showing an open file (or file select) dialog in access 2007 VBA?

I have tried using Application.GetOpenFileName as I would in Excel, but this function doesn't exist in Access.

like image 786
jwoolard Avatar asked Jul 07 '09 10:07

jwoolard


People also ask

What is Open File dialog?

OpenFileDialog component opens the Windows dialog box for browsing and selecting files. To open and read the selected files, you can use the OpenFileDialog. OpenFile method, or create an instance of the System.

How do I open a dialog file in Python?

Use the askopenfilename() function to display an open file dialog that allows users to select one file. Use the askopenfilenames() function to display an open file dialog that allows users to select multiple files.

How do I open the file explorer dialog box?

To access this dialog box, select Open from the File menu and then choose File.

Which function is used for opening the file dialog box?

The Open dialog box lets the user specify the drive, directory, and the name of a file or set of files to open. You create and display an Open dialog box by initializing an OPENFILENAME structure and passing the structure to the GetOpenFileName function.


1 Answers

My comments on Renaud Bompuis's answer messed up.

Actually, you can use late binding, and the reference to the 11.0 object library is not required.

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 the above works well in the runtime also.

like image 88
Albert D. Kallal Avatar answered Oct 07 '22 10:10

Albert D. Kallal