Macro to auto save file using the format YYMM

G

Guest

Hi,

I recorded a macro that automatically saves a file then change the formula
in cell A1 to today's date, ie =today(), then save the file. I have a problem
with the last part...is there any way I can set the macro such that the file
will be saved as "c:\YYMM ABC" where 'YYMM' is the format of the date
(probably can be taken from cell A1) and 'ABC' is my own file name?

Thanks!
 
D

Dave Peterson

You can get the date right in the code:

dim myFileName as string
myfilename = "C:\" & format(date,"yymm") & " ABC.xls"

activeworkbook.saveas filename:=myfilename, fileformat:=xlworkbooknormal
 

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