Connecting Tech Pros Worldwide Forums | Help | Site Map

FileDialog DataType not defined

Newbie
 
Join Date: Nov 2006
Posts: 1
#1: Nov 14 '06
Although I'm relatively new to Access VBA, I've done a lot of macro programming in Excel VBA. The problem I'm having is that I get a 'User Type not defined' error at this line -

Dim fd As FileDialog

I'm currently running Access 2003.
My objective is to select a file in a directory and extract information (mainly path but also some info from the filename) and then make file names based on that selection for importing into Access.

Sub AutoImport()
Dim FileTitle, ErrorMsg, BasePath, SystemName As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
.
.
.
End Sub

NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#2: Nov 14 '06

re: FileDialog DataType not defined


As far as I can see there is no variable type of 'FileDialog' in the main Access libraries.
Is this something you were used to using in Excel?
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#3: Nov 15 '06

re: FileDialog DataType not defined


Quote:

Originally Posted by NeoPa

As far as I can see there is no variable type of 'FileDialog' in the main Access libraries.
Is this something you were used to using in Excel?

The FileDialog is only available from Office XP versions and maybe later. Is your version older than this?
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#4: Nov 15 '06

re: FileDialog DataType not defined


Quote:

Originally Posted by mmccarthy

The FileDialog is only available from Office XP versions and maybe later. Is your version older than this?

BTW, if you do have an office xp or later version you may just need to create a reference to the library.

Go to Tools - References and look for Microsoft Office 10 Library or later version.
Reply