Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filedialog error on form

Status
Not open for further replies.

ProgramError

Programmer
Mar 2, 2005
1,027
GB
I'm hoping to use the following to get a path to a file but I get an error with the line. Dim fd As FileDialog
"User defined type not defined"
I suspect it may need a reference setting but I'm not sure which it is. Can anyone help?

Dim sFilePath As String
Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.Filters.Clear
fd.Show

sFilePath = fd.SelectedItems(1)
txtFilePath.SetFocus
txtFilePath.Text = sFilePath

Ian Mayor (UK)
Program Error
If people say I have bad breath, then why do they continue to ask me questions and expect me to answer them?
 
You have to reference the Microsoft Office x.0 Object Library.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV. I had Access library referenced but not office.

Ian Mayor (UK)
Program Error
If people say I have bad breath, then why do they continue to ask me questions and expect me to answer them?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top