ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filename with date and time (https://www.excelbanter.com/excel-programming/312576-filename-date-time.html)

alan

Filename with date and time
 
Friends,

The below portion of a macro saves a file with the current
date as part of the file name in the format:
Voyager 5-Oct.xls

ActiveWorkbook.SaveAs Filename:= _
"H:\Reporting\Voyager " & Format(Date, "d-mmm") & _
".xls"

I want to modify the macro so it also saves the file with
the current date and also the current time, in the
something like the format:
Voyager 5-Oct 12_08 pm.xls

How would I do this?

Thanks,
Alan

Tom Ogilvy

Filename with date and time
 
ActiveWorkbook.SaveAs Filename:= _
"H:\Reporting\Voyager " & Format(Date, "d-mmm") & _
format(time,"_hh AM/PM") & ".xls"

--
Regards,
Tom Ogilvy



"Alan" wrote in message
...
Friends,

The below portion of a macro saves a file with the current
date as part of the file name in the format:
Voyager 5-Oct.xls

ActiveWorkbook.SaveAs Filename:= _
"H:\Reporting\Voyager " & Format(Date, "d-mmm") & _
".xls"

I want to modify the macro so it also saves the file with
the current date and also the current time, in the
something like the format:
Voyager 5-Oct 12_08 pm.xls

How would I do this?

Thanks,
Alan




Frank Kabel

Filename with date and time
 
Hi
try
ActiveWorkbook.SaveAs Filename:= _
"H:\Reporting\Voyager " & Format(Now, "D-MMM hh_mm") & _
".xls"

--
Regards
Frank Kabel
Frankfurt, Germany

"Alan" schrieb im Newsbeitrag
...
Friends,

The below portion of a macro saves a file with the current
date as part of the file name in the format:
Voyager 5-Oct.xls

ActiveWorkbook.SaveAs Filename:= _
"H:\Reporting\Voyager " & Format(Date, "d-mmm") & _
".xls"

I want to modify the macro so it also saves the file with
the current date and also the current time, in the
something like the format:
Voyager 5-Oct 12_08 pm.xls

How would I do this?

Thanks,
Alan




All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com