locked
MS Project 2010 Server: Macro for savinng RRS feed

  • Question

  • Hello together,

     

    we working on the MS-Project Server 2010, but for additional archivieng etc. I try to create a macro:

     

    Sub PDF() 
      DocumentExport FileName:="C:\[b]NAME_[/b]" & Format(Now, "yyyy_mm_dd") & ".pdf", IncludeDocumentProperties:=False, IncludeDocumentMarkup:=False 
      FileSaveAs Name:="", FormatID:="" 
    End Sub


    I want to save the file on C: with the current Name and Date. The problem with the date I solved (the Code) but I don't know anything for the problem with the name of the project. Is it possible to read out the name of the project?

     

    Thx for your support.

    Toby

    Friday, August 26, 2011 3:13 PM

Answers

  • der_toby,

    The name of the current project is:

    ActiveProject.Name

    Hope this helps.

    John

    Friday, August 26, 2011 7:56 PM
  • Hi,

    Why? Because you cannot Save as without giving a name
    Mind you, there's a tricky detail about Project.name that you should be aware of - depending on the Windows explorer setting to show .mpp with the name or not, VBA will return the nme with or without VBA. The following will help you:

    TheName=activeproject.name

    if not right(thename,4)=".mpp" then thename=thename & ".mpp"

    filesaveas "C:\" & thename

    You do notneed the format parameter when teh extension is mpp

    The legend statement is OK.

    Greetings,

     

    Monday, August 29, 2011 10:54 AM

All replies

  • der_toby,

    The name of the current project is:

    ActiveProject.Name

    Hope this helps.

    John

    Friday, August 26, 2011 7:56 PM
  • Hello John,

    that helps for my problem discussed above.

    But: I have a failure message if I start the macro:
    The programm will debug here: 

    FileSaveAs Name:="", FormatID:=""

    Do you know why?

    Another problem I have: I want to prepar the page setup before saving a pdf.

    Therefore I insert the following in the macro (first row):

        FilePageSetupLegendEx LegendOn:=0

     

    Thank you again,

    Toby

    Monday, August 29, 2011 8:31 AM
  • Hi,

    Why? Because you cannot Save as without giving a name
    Mind you, there's a tricky detail about Project.name that you should be aware of - depending on the Windows explorer setting to show .mpp with the name or not, VBA will return the nme with or without VBA. The following will help you:

    TheName=activeproject.name

    if not right(thename,4)=".mpp" then thename=thename & ".mpp"

    filesaveas "C:\" & thename

    You do notneed the format parameter when teh extension is mpp

    The legend statement is OK.

    Greetings,

     

    Monday, August 29, 2011 10:54 AM
  • Toby,

    You're welcome. It looks like Jan took care of your remaining issue.

    John

    Monday, August 29, 2011 3:59 PM
  • hi Jan,

    CAn you look into this post:

    http://social.msdn.microsoft.com/Forums/en-US/project2010custprog/thread/4b7a4213-adce-4671-be48-d08695688010/

    Reg:How to launch the MS project proffesional 2010 programatically to publish/save .mpp to project server 2010


    Thanks & Regards, Krishna

    Tuesday, October 30, 2012 5:34 AM