locked
fileSaveAs and rename with Date() ? RRS feed

  • Question

  • I tried this;

     FileSaveAs Name:="C:\Documents and Settings\Richard MCclanahan\My Documents\MethodProject & Date().mpp", FormatID:="MSProject.MPP"

    No luck for obvious reasons, I don't know where to concatenate the date to the end of the file name

    Pj Pro 2007

    Pj Server 2007

    Rick

     

    Thursday, September 30, 2010 3:05 PM

Answers

  • Hi Rick,

    try the following: FileSaveAs Name:="C:\Documents and Settings\Richard MCclanahan\My Documents\MethodProject" & Date() & ".mpp", FormatID:="MSProject.MPP"

    Does that work?
    Barbara

    • Proposed as answer by Jim Aksel Thursday, September 30, 2010 7:15 PM
    • Marked as answer by rixmcx59 Friday, October 1, 2010 3:23 AM
    Thursday, September 30, 2010 3:11 PM
  • Hi,

    Depending on local regional settings Date() on its own can produce invalid file name format. In addition I always like to use year month day date format in file names so files are formatted in a logical date format in file views. SO I use:

     FileSaveAs Name:="C:\Documents and Settings\Richard MCclanahan\My Documents\MethodProject" & Format(Date(),"yyyy-mm-dd") & ".mpp", FormatID:="MSProject.MPP"


    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    • Marked as answer by rixmcx59 Friday, October 1, 2010 3:23 AM
    Thursday, September 30, 2010 9:25 PM

All replies

  • Hi Rick,

    try the following: FileSaveAs Name:="C:\Documents and Settings\Richard MCclanahan\My Documents\MethodProject" & Date() & ".mpp", FormatID:="MSProject.MPP"

    Does that work?
    Barbara

    • Proposed as answer by Jim Aksel Thursday, September 30, 2010 7:15 PM
    • Marked as answer by rixmcx59 Friday, October 1, 2010 3:23 AM
    Thursday, September 30, 2010 3:11 PM
  • Hi,

    Depending on local regional settings Date() on its own can produce invalid file name format. In addition I always like to use year month day date format in file names so files are formatted in a logical date format in file views. SO I use:

     FileSaveAs Name:="C:\Documents and Settings\Richard MCclanahan\My Documents\MethodProject" & Format(Date(),"yyyy-mm-dd") & ".mpp", FormatID:="MSProject.MPP"


    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    • Marked as answer by rixmcx59 Friday, October 1, 2010 3:23 AM
    Thursday, September 30, 2010 9:25 PM
  • awesome! thank you
    Friday, October 1, 2010 3:24 AM
  • Thanks Barbara
    Friday, October 1, 2010 3:25 AM