Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm trying to append the date to the filename of the worksheet 1

Status
Not open for further replies.

drbtodd1971

Programmer
Mar 28, 2007
34
I have the following code and keep getting errors because it appears to be defaulting to the default date setting which includes slashes.

How can I append the date without the slashes, I've tried formatting it in various ways but with no luck.

Dim dtMyDate As Date
dtMyDate = Format(Date, "DDMMYY")

ActiveWorkbook.SaveAs Filename:="C:\Temp\WinsfordWalkSheet2007Week_" & dtMyDate
 
Dim dtMyDate As [!]String[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



Hi,
Code:
Dim sMyDate As [b]STRING[/b]
sMyDate = Format(Date, "DDMMYY")

ActiveWorkbook.SaveAs Filename:="C:\Temp\WinsfordWalkSheet2007Week_" & sMyDate & ".xls"


Skip,

[glasses] [red][/red]
[tongue]
 




BTW, I'd format the date YYMMDD so that the name would sort as expected, if that would be an issue for you.

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top