Date as filename

  • Thread starter Thread starter PVANS
  • Start date Start date
P

PVANS

Hi there,

I am trying to include a a date that is referenced in a cell in my workbooks
filename. The macro crashes each time because it says it cannot include" / "
in the filename.

I have tried to change the format of the cell, the macro still takes the
date as 22/07/09.

Please can someone suggest how i can take the date listed in the cell,
remove the "/" and include it in the filename?

Thanks for all the help that this forum has provided already, I really
appreciate it.

Regards,
PVANS
 
With the date in cell A1; try

strFile = Format(Range("A1"),"dd-mm-yyyy")

Then use this variable to SaveAs..

If this post helps click Yes
 
dim strDate as string
strDate = format(range("A1").value,"dd.mm.yyyy")

then use strDate in your filename
 
Sorry, just to clarify... I am running a macro that saves the workbook
automatically.

I am using the following code in the macro:

ActiveSheet.Copy
ActiveWorkbook.SaveAs "c:\temp\" & Range("H7")
 
To Sam and Jacob,

It works beautifully. Thank you so much

You guys really have been such a great help. Thank you!

Regards,

PVANS
 
Back
Top