GetOpenFilename Folder specfication

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

How do you specify the initial folder for
Application.GetOpenFilename()?

I've tried numerous Application.* attributes, haven't
been able to find the right one. I also tried specifying
the folder spec in the GetOpenFilename() argument,
doesn't work.
 
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
 
thanks!
-----Original Message-----
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



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




"Alan" <[email protected]> wrote in
message news:[email protected]...
 
Back
Top