missing AfterSave event RRS feed

  • Question

  • Hello,

    I have the MSP document in mpp format and I want to save it as xml when closing this document. How can I do it? I look on Project object Events and there are only BeforeClose and BeforeSave events. And both events go so early - before is document saved. There is nothing like AfterSave event (or AfterClose - but it would be unuseable because I need document still opened to save it in xml). Is any way how save document in diferent format when it is closing?


    Wednesday, April 25, 2012 12:06 PM

All replies

  • And some mor specific information: I need to make a different copy of mpp document when is file closing (xml file on different location). Do not need to make it after each saving, just on closing. And Is there any way to supress "save as" dialog when xml file exists? It would be overwrited withought question.
    Wednesday, April 25, 2012 12:10 PM
  • I suspect your solution is not too useful. Saving as .xml file takes a long time as the resulting files are large. I recommend you just add a button to the menu or ribbon and train PM's to click it when the project is in a suitable state for saving. A project might be saved a dozen times a week, but only one xml copy may be needed. As a medium sized file can take 5 minutes or more to save as xml....

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management

    Wednesday, April 25, 2012 9:50 PM
  • I need to use xml file as export file to import data from MSP to our application. And I need to do it automatically.

    This concept works and we use it with MSP 2003. We use ODBC and data saved in database format. But this is not useable in MSP2010.

    Thursday, April 26, 2012 7:53 AM
  • OK you can get the AfterSave event by using Application level events.

    Add these lines to the 'ThisProject' section in the VBA editor:

    Dim X As New EventClassModule

    Sub InitializeApp()
        Set X.App = Application
    End Sub

    then add a reference to hte InitializeApp sub in the ProjectOpen event.

    Then create a new class module with this line in it:

    Public WithEvents App As Application

    then in the class module click the drop down where it says "General" and select 'App'

    Then in the other drop down pick ProjectAfterSave.

    Brian Kennemer - Project MVP
    DeltaBahn Senior Architect
    endlessly obsessing about Project Server…so that you don’t have to.
    Blog | Twitter | LinkedIn

    Thursday, April 26, 2012 8:42 AM