MrExcel Publishing
Your One Stop for Excel Tips & Solutions

varible filename?


Posted by brian charles on October 18, 1999 8:41 AM

I will be comparing two spreadsheets daily. One is
a constant, the other is created each day. I would
like to create a third that has as its filename, part
of the one created daily. I have stripped off
characters and created a constant "dateid" that is
refered to elsewhere in my macro. How can I also use
it in the new filename when saving?

Thanks.

BRian Charles


Posted by Chris on October 18, 1999 9:14 AM

You should be able to use some variation of the following:

ActiveWorkbook.SaveAs FileName:="C:\My Documents\New" & dateid & ".xls"

if dateid = "1018", then file created would be "New1018.xls"

HTH,
Chris