Date/Time in save as file name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I am sending a query out to a spreadsheet format:

DoCmd.TransferSpreadsheet yadda, yadda, yadda, conPath & "yadda yadda" & " -
Saved_" & Format(Date, "mm-dd-yyyy") & ".xls", True

I would like this portion to show the date AND time:
Format(Date, "mm-dd-yyyy")

Unfortunately, Windows will not allow a file to be saved with the ":"
(colon) character. Can anyone see a way around this? I tried using "."
(period) but that returned 0.00.00

Thank you in advance,
Nick X
 
You should use Now() instead of Date() that doesn't return the time.
I would save it in this format

Format(Now(), "yyyymmddhhmm")

It make it easier to sort the file by name in this format
 
Thank you, that'll work.

Ofer said:
You should use Now() instead of Date() that doesn't return the time.
I would save it in this format

Format(Now(), "yyyymmddhhmm")

It make it easier to sort the file by name in this format
 
Back
Top