Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem setting directory in xlDialogSaveAs

I am trying to set the directory to a default location
with the xlDialogSaveAs command but can't seem to get it
to work.

Here is my code:
MyDate = Replace(FormatDateTime(Now, vbShortDate), "/", "-
")
MyPath = "C:\Document and Settings\Administrator\My
Documents\Spreadsheets"
Application.Dialogs(xlDialogSaveAs).Show (MyPath
& "\NewSpreadsheet" & MyDate & ".xls")


I have tried changing the directory and setting the
lpstrInitialDir neither of which have worked. The save as
dialog box keeps reverting to my desktop.

Thanks,
Jonathan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problem setting directory in xlDialogSaveAs

MyDate = _
Replace(FormatDateTime(Now, vbShortDate), "/", "-")
MyPath = _
"C:\Document and Settings\Administrator\My Documents\Spreadsheets"
Chdrive MyPath
ChDir MyPath
Application.Dialogs(xlDialogSaveAs).Show _
(MyPath & "\NewSpreadsheet" & MyDate & ".xls")

Should work.

--
Regards,
Tom Ogilvy


Jonathan Crow wrote in message
...
I am trying to set the directory to a default location
with the xlDialogSaveAs command but can't seem to get it
to work.

Here is my code:
MyDate = Replace(FormatDateTime(Now, vbShortDate), "/", "-
")
MyPath = "C:\Document and Settings\Administrator\My
Documents\Spreadsheets"
Application.Dialogs(xlDialogSaveAs).Show (MyPath
& "\NewSpreadsheet" & MyDate & ".xls")


I have tried changing the directory and setting the
lpstrInitialDir neither of which have worked. The save as
dialog box keeps reverting to my desktop.

Thanks,
Jonathan



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Row height setting problem Machinist60[_2_] Excel Discussion (Misc queries) 4 July 8th 11 12:19 AM
Excel setting problem Rajula Excel Discussion (Misc queries) 4 January 26th 07 09:29 AM
Change of auto backup directory has created problem George NS Excel Discussion (Misc queries) 2 December 30th 06 08:06 PM
application.dialogs(xlDialogSaveAs) AND CHDIR Jules[_2_] Excel Programming 1 September 3rd 03 08:27 PM
Setting default directory prior to GetOpenFilename David R[_3_] Excel Programming 2 September 2nd 03 12:35 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"