Save As macro with date/time stamp

J

Jim A

Hi -
I have been trying to get a date and time stamp within my code. I have this:

ActiveWorkbook.SaveAs Filename:=Sheets("1").Range("B1").Value & " " &
Sheets("1").Range("AS1")

with range("AS1") being a worksheet function of =TEXT(NOW(),"dd-mmm-yy")
which does not allow for Time.

Can anybody help me get the date and time stamp in the code itself?

Thanks - Jim A
 
J

JE McGimpsey

One way:

ActiveWorkbook.SaveAs Filename:=Sheets("1").Range("B1").Value & _
Format(Now, " dd-mm-yy hh:mm:ss")
 

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