GetOpenFilename...what the heck

ExcelChampion

Well-known Member
Joined
Aug 12, 2005
Messages
976
I'm trying to open to a default folder but its not working and I have no idea why...

I've played with my code, but it keeps opening to the System32 folder on the Windows folder.

I'm in Access, and use this code to create an instance of Excel, and then prompt the user to open an Excel file.

Code:
    CurrProject_Path = CurrentProject.Path
    
    Set xlApp = CreateObject("Excel.Application")
    With xlApp
        ChDrive CurrProject_Path
        ChDir CurrProject_Path
        strPathFile = .GetOpenFilename("Excel Files (*.xls*), *.xls*")

Any ideas?

FYI, everything is on my local drive.
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Take a look at Help for GetOpenFilename; it doesn't open a file.
 
Upvote 0
Thanks, but I don't understand your post. Of course the function itself does not open a file, and I said nothing of that in my post. I want it to open the window to a default folder. I think that's pretty explicit in my post. Do I need to re-write my it to make it more clear?
 
Upvote 0
ChDrive and ChDir only apply to the current application (instance). Maybe use a FileDialog instead.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top