ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GetOpenFilename Folder specfication (https://www.excelbanter.com/excel-programming/282991-getopenfilename-folder-specfication.html)

Alan[_18_]

GetOpenFilename Folder specfication
 
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.



Ron de Bruin

GetOpenFilename Folder specfication
 
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)
www.rondebruin.nl



"Alan" wrote in message ...
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.





Alan[_18_]

GetOpenFilename Folder specfication
 

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)
www.rondebruin.nl



"Alan" wrote in

message ...
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.




.



All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com