ExcelBanter

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

Andy

GetOpenFilename - Default Folder
 
Hi I apologise if I am asking a commonly question this newsgroup has
answered before.

I pick up a file selected by the user. I want to specify a default folder
from where my user can select his transaction file. Is this possible?

This is what I am currently doing.
TxnFilename = Application.GetOpenFilename("All Files (*.*), *.*", 1, "Import
Transaction Details for List")

Thanks
Andy



Dan E[_2_]

GetOpenFilename - Default Folder
 
Andy,

Use a chdir statement.
ie
ChDir ("C:\My Excel Files")
TxnFilename = Application.GetOpenFilename("All Files (*.*), *.*", 1, "ImportTransaction Details for List")

Dan E

"Andy" wrote in message ...
Hi I apologise if I am asking a commonly question this newsgroup has
answered before.

I pick up a file selected by the user. I want to specify a default folder
from where my user can select his transaction file. Is this possible?

This is what I am currently doing.
TxnFilename = Application.GetOpenFilename("All Files (*.*), *.*", 1, "Import
Transaction Details for List")

Thanks
Andy





Ron de Bruin

GetOpenFilename - Default Folder
 
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



"Andy" wrote in message ...
Hi I apologise if I am asking a commonly question this newsgroup has
answered before.

I pick up a file selected by the user. I want to specify a default folder
from where my user can select his transaction file. Is this possible?

This is what I am currently doing.
TxnFilename = Application.GetOpenFilename("All Files (*.*), *.*", 1, "Import
Transaction Details for List")

Thanks
Andy





Andy

GetOpenFilename - Default Folder
 
Works like a charm.

Many thanks
Andy




All times are GMT +1. The time now is 06:02 AM.

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