Link to home
Start Free TrialLog in
Avatar of jcosta_sr
jcosta_sr

asked on

Need Help with FileDialog Property in MS Acess VBA

Hi All,

  I'm trying to use the File Dialog property to get input from a user to get the name and location to create a exported spreadsheet.

  I can export the spreadsheet fine.  Here is the problem.

  Here is the code:

Dim dlgSaveAs As FileDialog

    Set dlgSaveAs = Application.FileDialog( FileDialogType:=msoFileDialogSaveAs)

    dlgSaveAs.Show

Here is the error - the Dim statement is where the error is happening

Compile:  Error

User-Defined type not defined

Can anybody help?

Thanks in Advance
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Just change it to:
Dim dlgSaveAs As Object

That should do it.
Avatar of Rey Obrero (Capricorn1)
Avatar of jcosta_sr
jcosta_sr

ASKER

when I subsitute object for FileDialog the first line passes but then the second line

Set dlgSaveAs = Application.FileDialog( FileDialogType:=msoFileDialogSaveAs)

fails

Named argument not found.  (FileDialogType is highlighted)
ASKER CERTIFIED SOLUTION
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial