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

Excel - Open file dialog box - can I go to a certain directory? 3

Status
Not open for further replies.

srogers

Technical User
Aug 15, 2000
201
US
Oops - I had another question too.

I use this to open the Open File dialog box:

sFilename = Application.GetOpenFilename("All files (*.xls*), *.xlt*")

But now I've had someone ask if I open it with the right drive letter and folder.

Can that be done?

Thank you -
 
Hi
One way you could do this is to change the default directory before calling the dialog box and change it back after, ie

Code:
ChDir ("Z:/SharedWork/Projects")'change as appropriate
sFilename = Application.GetOpenFilename("All files (*.xls*), *.xlt*")
ChDir (Application.DefaultFilePath)

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
In addition of ChDir you may also have to play with ChDrive.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
My thanks to you both.

First I tried just using ChDir but that didn't do it alone. I had to use them both.

ChDrive "G"
ChDir ("G:\MyDirectory\PastPd")

Sharon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top