Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need Help with FileDialog Property in MS Acess VBA

Posted on 2004-09-24
6
Medium Priority
?
575 Views
Last Modified: 2010-07-27
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
0
Comment
Question by:jcosta_sr
  • 2
4 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12146084
Just change it to:
Dim dlgSaveAs As Object

That should do it.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 12146412
0
 

Author Comment

by:jcosta_sr
ID: 12146774
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)
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 2000 total points
ID: 12146813
Remove the FileDialogType:= part, so you have:
Set dlgSaveAs = Application.FileDialog(msoFileDialogSaveAs)

(the argument is DialogType, I believe not FileDialogType). You may need to add a reference to the Microsoft Office <your version) Object Library for this to work. Otherwise, this should also work:

Set dlgSaveAs = Application.FileDialog(2)
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question