File dialog box

G

Guest

Hi

I am trying to use a file dialog box in VBA to get a file path.
I have used the following code copied out of help

Dim dlgOpen As FileDialog

Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)

With dlgOpen
.AllowMultiSelect = True
.Show
End With

Then I get the following error message

Compile error:

User-defined type not defined

So I went on the web and down loaded some code. I imported the .dll file
into the references and ran the code; I got the same error message. So how do
I get access to run the file dialog box?

Thanks for your help

matt
 
R

Rick Brandt

Matt said:
Hi

I am trying to use a file dialog box in VBA to get a file path.
I have used the following code copied out of help

Dim dlgOpen As FileDialog

Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)

With dlgOpen
.AllowMultiSelect = True
.Show
End With

Then I get the following error message

Compile error:

User-defined type not defined

So I went on the web and down loaded some code. I imported the .dll file
into the references and ran the code; I got the same error message. So how do
I get access to run the file dialog box?

Thanks for your help

What version are you using? The file dialog is fairly new and won't work in
most versions. The API call is better since it works everywhere.

http://www.mvps.org/access/api/api0001.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top