Forum Discussion

Gilgamesh1964's avatar
Gilgamesh1964
Brass Contributor
Aug 15, 2022

Is there an alternative to Auto_Open for when MS Project lauches.

Hello,

I want to have a macro in my global.mpt that will activate when MS Project launches regardless of the schedule file.

I'm only looking for it to happen that once (to modify the xml in some custom ribbons) and do not need it to activate for each file open.

Is there such a macro entry that I can use? (I'm using MS Project Online Desktop)

Thanks in advance

7 Replies

  • Gilgamesh1964's avatar
    Gilgamesh1964
    Brass Contributor
    Hello,
    Unfortunately there has been no response so I'm now assuming that having a macro run when launching MS Project is not possible.
    I was hoping for something along the lines of AutoExec is MS Word.
    However I will still thank those who took the time to consider this query.
    • Dale_HowardMVP's avatar
      Dale_HowardMVP
      MVP
      Gilgamesh1964 --

      After posting my first response, I had another idea for you. Why don't you create a new blank project named something like Update Ribbons? In that project file, create a Project_Open macro that contains the VBA code for updating the ribbons. Send this Microsoft Project file to each of your PMs and instruct them to allow Microsoft Project to run macros in the project. After the macro runs and updates the ribbons, the user could close and discard the project.

      That would be a "one and done" approach, but of course, it assumes you will not need to update the ribbons with any changes after the initial round of updating. Just an additional thought for you. Hope this helps.
      • Gilgamesh1964's avatar
        Gilgamesh1964
        Brass Contributor
        Thank you for responding.

        Unfortunately we only use Project Desktop and don't have access to Project Online or Server so enterprise options won't work for us. I did put Auto_Open into the local global.mpt file but it didn't run when launching project.

        I do have a separate file with a macro that installs the ribbons so that part is covered.
        But MS Project removes some of my ribbon formatting between sessions, so I thought if there was something that runs are startup I might be able to reinstate the formatting each session (testing would be required to see if it would work). Asking the PMs to run this file once every time they start Project probably won't fly, so we may need to live with the lost formatting. 😞
    • Dale_HowardMVP's avatar
      Dale_HowardMVP
      MVP
      Gilgamesh1964 --

      I want to apologize for not responding to your question sooner. I was hoping that one of our VBA gurus would answer your question, but that did not happen.

      So, allow me to take a stab at answering your question. First of all, you definitely want to use the Auto_Open macro to run the VBA code whenever Microsoft Project is launched. I believe you will want to add this macro to the Enterprise Global file so that it runs automatically for every user each time they launch Microsoft Project and connect to Project Online.

      When the code runs, however, you need to test Microsoft Project to determine if the macro code has already run and has modified the ribbons. My recommendation for this test would be to create a custom enterprise Project field named something like Ribbon_Updated. Make the field a custom Flag field and set the default value to No for this field.

      Then in your Auto_Open macro, perform a test on the Ribbon_Updated field. If the value is No, then the rest of the macro code should run. If the value is Yes, the macro should exit after the test and not run any further.

      Don't know if this is any help to you, but at least I tried. Let us know how things go.

Resources