Project 2010: adding ribbon RRS feed

  • Question

  • In Project 2007 & earlier, we have a macro that is run from a toolbar button. We created the module & toolbar and copied them into GLOBAL.MPT using an auto-open macro.

    With Project 2010, I assume Ribbons are the way to go. I've read an MSDN article titled "How to: add a custom command to the ribbon" ( and this works perfectly, BUT for one big problem - the ribbon it creates is specific to the active project. We need to create a ribbon that is available on all projects opened or created in future.

    Is there something missing from that article that explains the ribbon-specific equivelant of moving a module or toolbar into GLOBAL.MPT?

    Failing that ... is there some other approach we should be taking to make our macro available as a ribbon button (or on the quick access toolbar)?

    Tuesday, April 13, 2010 4:02 PM


All replies

  • Hi Steve,

    I'm not into writing macros but I know you can use the Organizer to copy modules to the Global (File/Info/Organize Global Template) as you did with 2007.  However, how it gets onto the appropriate ribbon, I've no idea :(.  Give it a try and see if you can find a way round.  There is certainly no way in the Organizer to copy ribbons as you could with toolbars.  This would appear to be an omission in 2010.

    Mike Glen
    MVP Project

    Tuesday, April 13, 2010 7:29 PM
  • However, how it gets onto the appropriate ribbon, I've no idea :(.  Give it a try and see if you can find a way round   ....  This would appear to be an omission in 2010.

    Mike Glen
    MVP Project

    Give what a try, Mike?

    Learning about ribbons from scratch, it appears like we should create our own ribbon then add it to MSProject. I'm not sure what you mean by "the appropriate ribbon". We can create a ribbon, we can use our macro, we can add command to our ribbon, we can make our ribbon appear in an open project, but it just doesn't appear for other projects or projects I open later.

    If MSProject 2010 offered the ability to create custom ribbons, but lacked the ability to actually remember them, then that would be  .... regretable.


    Tuesday, April 13, 2010 8:44 PM
  • All,

    Steve and I are after the same thing: How to programmatically add a tab to the ribbon with a button assigned to a Macro. Using the instructions here: ( this adds a tab to the ribbon with a button but only for the open project. Closing the project that this macro was run in removes the tab from the Ribbon.

    I can right click on the Ribbon, select Customize Ribbon, add a Tab, a Group and add a Macro to this group and it stays. If I close Project 2010 and reopen it the Tab, Group and Button is still there. The questions are:

    1. Where does this custom Tab and Group get stored? I can't see it in the Organizer... Toolbars used to be stored there but toolbars have been replaced by the Ribbon.

    2. Can I perform these steps programmatically (using VBA) to automate the process of adding the Tab, Group and button?

    Additional comments for those who wish to ponder this:

    There is a way to Export a custom Ribbon and Import it but this wipes out any customization already on the Ribbon so that's not a good solution. Selectively Importing certain customizations to the Ribbon would work but there doesn't appear to be a way to do this.

    The Project_Open command has been suggested as a way to automatically make the Ribbon appear but this won't work when opening a New project.

    Hope this explains it well enough to see if anyone has the solution.


    Tuesday, April 13, 2010 9:24 PM
  • What I meant is to try using the Organizer to copy your macro(module) to the Global, and then open up another project and see if you can copy it back.  If you can, I don't know how you would get the macro onto the ribbon you'd find most applicable.
    Wednesday, April 14, 2010 3:13 PM
  • The MSDN article instructions in step 2 have you adding the code to ThisProject - that's why the changes are just showing up in the active project. To have the custom ribbon and corresponding code show up for all projects, you need to add the code to ProjectGlobal (global.mpt).



    Thursday, April 15, 2010 8:19 PM
  • Hi Heather,

    Thanks for responding...

    The macro *is* in global.mpt, I think the command that is the problem is this line in the macro:

    ActiveProject.SetCustomUI (ribbonXml)

    We've tried to use the usual commands to make this apply to the application but can't seem to make it work. Perhaps we are using the wrong syntax. Any ideas???

    We are still stuck. Any help is greatly appreciated!




    Thursday, April 15, 2010 11:55 PM
  • Let me check on the SetCustomUI command.

    I'd double-check though that the macro is really in the correct location since I tried both scenarios and with the same exact code when I move it from the local project to the global - the custom ribbon started to show up for all projects. Make sure in Visual Basic environment, all the code is in ThisProject(Global.mpt).

    Also, are you connectin Project to Project Server?


    Friday, April 16, 2010 12:20 AM
  • Heather,

    That helped but only solved half the problem. This only works if you open an existing, saved project. The Tab/Button still won't show up if you open a New project. It doesn't look like SetCustomUI can be set at the Application level... I've looked through the Help and tried various commands but nothing works.

    Not connected to Project Server.

    Still looking for a solution...

    Thanks again!

    Friday, April 16, 2010 12:07 PM
  • Instead of using the Project_Open event, use Project_Activate, e.g. (comment-out the MsgBox line when you get tired of it):

    Private Sub Project_Activate(ByVal pj As MSProject.Project)
        MsgBox "Activated project: " & pj.Name
    End Sub

    As Heather said, be sure all the code is in ThisProject (Global.MPT).

    Also, if you have another macro that sets a different ribbon customization by using SetCustomUI, the second call overrides the first -- so you must combine the XML into one SetCustomUI call.

    Thanks for pursuing this issue... I'll update the SDK article for RTM.


    • Proposed as answer by Jim Corbin Tuesday, April 20, 2010 11:32 PM
    Tuesday, April 20, 2010 6:03 PM
  • Jim/Heather,

    I am making progress thanks to your help! I can see now how to add the Project_Activate code to the ThisProject (Global.mpt) manually but can this be done programmatically? In other words, I want this to work on another user's system without having them type in the code. I can send them a project file with an Auto_Open or Project_Open macro that copies modules using OrganizerMoveItem but how do I copy the code into ThisProject (Global.mpt)? Can this be done?

    Thanks again!

    Wednesday, April 21, 2010 9:18 PM
  • Hi Jim,

    By now you have probably read Rod's (negative) answer in the developer newsgroup.


    Thursday, April 22, 2010 6:18 AM
  • Negative? Hmphh! It prompted me to come by here! Sure I don't know how to automatically copy the code across, but I did suggest creating all new proejcts from a template that already has the code. This would obviously introduce a training and process component, but it is doable.

    The other alternativce is to write an Add-in for the code which would solve the problem.

    Friday, April 23, 2010 12:12 AM
  • What we need here is a VSTO example. Now there is one: see Customizing the Project 2010 ribbon with a VSTO add-in in the other forum.
    Friday, April 23, 2010 6:24 PM
  • Hi Jim

    I have a problem which appears to be the same as you described 12 months ago.

    I need to programatically load a new Project 2010 ribbon into various workstations (probably in their globzl.mpt) so that whenever they start Project (whether via a saved file of new file), the new ribbon appears.

    Did you resolve how to do this?



    Tuesday, June 14, 2011 5:47 AM
  • Hi Jeff,

    The best solution is to create a VSTO add-in, and then publish it using ClickOnce. It is still up to users to install the add-in for their Project Std or Pro installations, but simplified installation, prerequisites, and updates are more easily handled, than with VBA macros.

    Please see the Project SDK, for the updated content referred to earlier in this forum thread:

    How to: Use Managed Code to Add a Custom Command to the Ribbon, and the Deploying the Add-in section of Walkthrough: Building a Managed Code Add-in to Check PWA Compatibility.



    Jim Corbin [MSFT]
    Tuesday, June 14, 2011 3:53 PM