Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Jul 2005
    Location
    Earth, New Jersey, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Current Date (MS Excel 2002)

    I'm running a marco and I want to save the file naming convention with the current date every time it's run. I'm getting an error when I run the macro. here is the code. Can you please guide me in the right direction. Thanks a bunch!

    ActiveWorkbook.SaveAs Filename:= _
    "P:1IDds_mapping_errorlogs"Today = Now"_error-idi-icsw.xls", FileFormat:=
    xlNormal , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
    , CreateBackup:=False

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Current Date (MS Excel 2002)

    Try

    ActiveWorkbook.SaveAs Filename:= _
    "P:1IDds_mapping_errorlogs" & Format(Date, "yyyymmdd") & "_error-idi-icsw.xls", FileFormat:=
    xlNormal , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
    , CreateBackup:=False

    This will include the date in yyyymmdd format, for example 20061213. You can use another format if you like, but please note that you can't include the date as 12/12/2006 since slashes / are not allowed in a file name.

  3. #3
    Star Lounger
    Join Date
    Jul 2005
    Location
    Earth, New Jersey, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current Date (MS Excel 2002)

    Hi Hans!
    I'm getting a compile error "syntax error". I copied and pasted the formula as posted. <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Current Date (MS Excel 2002)

    There should be a space and an underscore _ after FileFormat:=

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •