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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with FileDialog Method

Status
Not open for further replies.

bhujanga

Programmer
Oct 18, 2007
181
US
I'm using the exact code in two different forms. In one form it works fine, on the other I get this message:

Method 'FileDialog' of object'_Application' failed

This is the code:
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.InitialFileName = Path
.Show
rtnFile = .SelectedItems(1)
End With

I haven't the slightest idea what it is not liking. Any suggestions?
(I'm quite certain the Path is not the problem)
 
If you are in the VBA editor go to Tools > References and look for Microsoft Scripting Runtime. If its not checked, check it and try again.
 
I checked it and I still get the same message. Is there a better way to open the file selection screen? My goal is just to save the selected filename including its path in a field.
Thanks.
 
What application? You need a reference to Microsoft Office xx.0 Object library, it's not default in ms access.

combo
 
I'm using Access. It's working perfectly in another database I wrote a couple years ago. But I can't get it to work in this one. They're both running on the same group of PCs.
 
So try to add a reference to the Microsoft Office library in the access file.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top