specifing default folder with GetOpenFilename

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I'm am using the GetOpenFilename method to allow a user to
pick a spreadsheet to open. This is to by-payss the
enable/disable macro option. I want to start the user in
a specific network folder(instead of their
defaultfilepath). Is there a way to do this?

I have tried the Application.DefaultFilePath = ("xxxx")
but this only changes the default folder the next time the
user accesses the the system and not the current instance.

Thanks,

Brian.
 
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
 
Back
Top