Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looking for filedialog box for vba 2

Status
Not open for further replies.

ProgramError

Programmer
Joined
Mar 2, 2005
Messages
1,027
Location
GB
HI,

I'm looking for a filedialog form/box for use in access VBA.
I intend using it to look for/at files and drives. the type of form which appears when you do a 'save as' on any program
(the tree type file picker).
I found the property fileDialog in the Access help files but I I get errors of 'user-defined type not defined' when I use

Dim fd As FileDialog

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)

can anyone help

Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
You need to check your references within VBA. You need to reference Microsoft Office 11 Object Library, I believe.
 
How are ya ProgramError . . .

I believe your missing a [blue]Reference Library[/blue], namely [blue]Microsoft Office X.X Object Library[/blue]. However adding the library just to get the file dialog is quite a bit of overhead!

Might I suggest the Common Dialog ActiveX control:

Basic: Using the Common Dialog Control

Specific to your cause: Displaying Open and Save As Dialog Boxes

The control is easy to use and you can even change the caption (Get File, Find File . . .). [blue]I find myself writing less code than other methods[/blue] available and using it more often.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
AceMan

What overhead is associated with referencing Libraries?

I have used the above reference and not noticed any particular performance hit on my database.

Thanks.
 
Thank you both

references already has Microsoft Office X.X Object Library selected.

Decided to use the common dialog control.

TheAceMan, Can't seem to fing the Common Dialog ActiveX control you mentioned. Links where useful. I spent ages looking for information about this.

Thanks once again, star for you both.


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
ProgramError . . .
ProgramError said:
[blue]Can't seem to fing the Common Dialog ActiveX control you mentioned . . .[/blue]
In [blue]form design view[/blue] click the ActiveX toolbar button
ActiveX.BMP
and find/Select [purple]Microsoft Common Dialog Control, Version x.x[/purple], then click any where inside the form. You'll find properties are abundant . . .

Calvin.gif
See Ya! . . . . . .
 
I had it in the references on one machine but not on another. Suspect the reference was available on the one machine because I have VB6 installed on it.
Manage to find the file which includes the reference for the common dialog controls.
For anyone interested its...

msldbusr.dll

and

comdlg32.zip

both found on a google search

Hope this helps someone else.


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top