HI,
I need to open hundreds of published projects in project server 2010, calculate each one of them, publish, close and checkin, one after other using VBA. This will run using an Administrator account in Project Server server.
The problem is when you try to close a project after publishing it, it opens a dialogue box asking if you want to check in and this stops the macro.
I recorded and edited the macro below, instead making a calculation, I change the view to Calendar then go to Tracking View, only to set that some changes were done in the project. Also I dit it on two project as an example.
Sub Test_1()' Macro Test_1' Macro recorded in 04/17/11 by SERVER\ricardos. FileOpenEx Name:="<>\Test 1 - Sample Project 1", ReadOnly:=False ViewApplyEx Name:="&Calendar", ApplyTo:=0 ViewApplyEx Name:="&Tracking Gantt", ApplyTo:=0 Publish FileCloseEx pjDoNotSave, , True FileOpenEx Name:="<>\Test 2 - Sample Project 2", ReadOnly:=False ViewApplyEx Name:="&Calendar", ApplyTo:=0 ViewApplyEx Name:="&Tracking Gantt", ApplyTo:=0 Publish FileCloseEx pjDoNotSave, , TrueEndSub
After publish the project I use the FileCloseEx pjDoNotSave,,True because I do not need to save it again and the true is to checkin the project without opening the dialogue box.
When I ran the macro I got the following message:
Execution time error '-2147417848 (80010108')
The method 'FileCloseEx' of object '_MSProject failed.
and it looks the project is closed, but it remains checked-out in Project Server.
Any ideas on how can I close a project after publishing without opening any dialogue box using VBA?
Thank you.
Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner