GetOpenFilename w/default starting directory

L

lance-news

Is there a way to use GetOpenFilename with a default starting directory?

Lance
 
R

Ron de Bruin

Hi Lance

Try this example sub
I will save your default folder first to set it back at the end

Sub test()
Dim SaveDriveDir As String
Dim TheFileName As Variant
SaveDriveDir = CurDir
ChDrive "C"
ChDir "C:\Data"
TheFileName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")

MsgBox "your code"

ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top