ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Driectory changing (https://www.excelbanter.com/excel-programming/287236-re-driectory-changing.html)

Bob Phillips[_6_]

Driectory changing
 
Steve,

Known problem that should be easily circumvented by issuing a

ChDrive "F"

command before the ChDir

or you could take a look at the GetSaveAsFileName method which shows a
dialog box that allows navigating circa Windows Explorer to the directory.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steve P" wrote in message
...
I have a macro that saves a file using the getsave function
I want it to default to a specific directory. The save as
box always comes up but the directory is not always
correct. Any thoughts? I want it to come up as
f:\models\2004 strategies

' getsaveas Macro
' Change Default Directory
ChDir "F:\MODELS\2004 Strategies"

' File Filters
Filt = "Excel Files (*.xls), *.xls," & _
"All Files (*.*), *.*"

' Display *.xls as default
FilterIndex = 1

' Dialog box Caption
Title = "Select a File Name and Directory"

' Set Initial File Name
IName = "e_strategy.xls"

' Get Save as Box
filesavename = Application.GetSaveAsFilename _
(InitialFilename:=IName, _
fileFilter:=Filt, _
FilterIndex:=FilterIndex, _
Title:=Title)





All times are GMT +1. The time now is 03:33 PM.

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