J
John Keith
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
(e-mail address removed)
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
(e-mail address removed)