Solved

Need Help with FileDialog Property in MS Acess VBA

Posted on 2004-09-24
6
548 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
6 Comments
 
LVL 41

Expert Comment

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

That should do it.
0
 
LVL 119

Expert Comment

by:Rey Obrero
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 500 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now