Save Macro with date in name

R

RD

Hi,

I have a macro that I want to complete by saveing the file with the current
date ate the end of the file name.

I have this code but I get an error with the "DateAdd".

ActiveWorkbook.SaveAs Filename:="Monthly Accrual Upload" & DateAdd ("MMMM")
& " - " & DateAdd ("yyyymmdd") & ".xls", _
FileFormat:=xlText, CreateBackup:=False

How can I get the file name for April to be;

Monthly Accrual Upload - APRIL - 20101604

Thanks
Rick
 
J

Jacob Skaria

Use Format() as below

Msgbox "Monthly Accrual Upload - " & Format(Date, "MMMM - YYYYDDMM")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top