25 kwietnia 2012 12:06
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?
25 kwietnia 2012 12:10And 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.
25 kwietnia 2012 21:50ModeratorI 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 GillThe one and only Project VBA Book Rod Gill Project Management
26 kwietnia 2012 07:53
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.
26 kwietnia 2012 08:42Moderator
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
Set X.App = Application
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.