Solved

Need Help with FileDialog Property in MS Acess VBA

Posted on 2004-09-24
6
552 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 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 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 33
Any Way to Print an Import Spec? 3 28
Archiving Access table older than 6 months 9 37
Turn off MS Access Default=0 for Numerics 6 23
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

813 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

11 Experts available now in Live!

Get 1:1 Help Now