LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Problem saving file to My Documents

After doing some processing on a file I want to save it back to My
Documents with a new file name. I currrently have the following code:

strFilename = Title & " " & Format(Now(), "yyyymmdd") & " " &
Format(Now(), "hhmm") & ".xls"
MsgBox "Filename is " & strFilename
ActiveWorkbook.SaveAs strFilename

It appears that without specifiying a path name the file gets saved in
My Documents with the value of the string "Title" and the date/time
stamp added but I want to be more explicit on the path.

When I change the first line of code above to:

strFilename = "C:\My Documents\" & Title & " " & Format(Now(),
"yyyymmdd") & " " & Format(Now(), "hhmm") & ".xls"

the save as fails with the error of not finding the path. If I change
the line to:

strFilename = "C:\" & Title & " " & Format(Now(), "yyyymmdd") & "
" & Format(Now(), "hhmm") & ".xls"

the file is saved to the root on C: correctly.

Any ideas on why I can't explicitly save to My Documents? And, am I
correct that if I don't specify a path it will default to My
Documents?


John Keith

 
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
How can I change default file for saving documents? Anna Excel Discussion (Misc queries) 1 November 5th 09 12:59 AM
Problem with saving documents as .csv file [email protected] Excel Programming 2 January 23rd 08 12:20 AM
Saving Excel File in Current Directory NOT My Documents Fredriksson via OfficeKB.com Excel Programming 1 November 6th 06 09:08 PM
Saving Excel File in Current Directory NOT My Documents Fredriksson via OfficeKB.com Excel Programming 0 November 6th 06 07:47 PM
cannot open documents as viruscan says problem file? Wagon Burner Excel Discussion (Misc queries) 0 February 27th 05 06:27 PM


All times are GMT +1. The time now is 06:11 PM.

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

About Us

"It's about Microsoft Excel"