My VBA macro from Project 2007 doesn’t work in Project 2010!

If you have a VBA macro that worked in Project 2007 and doesn’t work in Project 2010, here are some things to try.

There are quite a few members from Project 2007 that are deprecated and hidden in Project 2010. Some of the hidden members still work as they did in Project 2007, some simply do nothing, and using some directly results in an error. If the macro relies on a hidden member that does not work the same way in Project 2010, you can get a variety of errors. For example, the Application.AnswerWizard property and the Office.AswerWizard object are both hidden — and the AnswerWizard no longer exists. The following macro results in a run-time error 1004 in Project 2010:

Sub GetAnswerWizard()
    Dim aw As Office.AnswerWizard
    Set aw = Application.AnswerWizard
End Sub

 To see the hidden members, go the VBE, press F2 for the Object Browser, right-click in the Members pane, and then click Show Hidden Members. The hidden members are in a light gray font. VBA Help does not include documentation of hidden members.

Check the macro for members that are hidden in Project 2010, and get documentation for any of those from Project 2007 VBA Help on MSDN. Then set a breakpoint to see whether the member does what is expected.

If the macro does not use any hidden members, trace through the macro by using breakpoints, to see what is going on. Some members in Project 2010 have additional parameters. For example, if you specify a parameter by position, such as Method(,,,”Value”), the parameter could be in the wrong order. When you use only a few parameters in a method that has many, is often best to use named parameters, for example, Method MyParam:=”Value”.

Note: The September update of the Project 2010 SDK includes an update of the Project 2010 VBA Help file for local use.

Comments (0)

Skip to main content