Saving: time/date for file name

  • I have written (recorded) a macro that compiles engineering data into a report format. This macro will run on a scheduled basis and I need to save the file for a particular time and date. I have yet to find a way to save the file simply with a date/time stamp for the file name. Any help on this would be appreciated.

  • Would this code work for you?


    Code
    Dim SaveFileName As String
    SaveFileName = "Date-" & Format(Now, "yyyymmdd") & _
        "-Time-" & Format(Now, "hhmmss") & ".xls"


    Regards,

    Barrie Davidson
    My Excel Web Page
    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!