Forum Discussion
Is there an alternative to Auto_Open for when MS Project lauches.
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.
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.
- Gilgamesh1964Aug 25, 2022Brass ContributorThank 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. ๐- John-projectAug 25, 2022Silver Contributor
I confess, I did read your post when it first appeared. I didn't respond because you asked if there was anything besides the Auto_Open Even and wasn't aware of anything but then my range of knowledge is limited to VBA. I probably should have responded by saying there might be an API that could do what you want but you'd have to do some research for that.
I do recall a previous post on this forum that is related to what you are trying to do. I'm not sure if it will help but you could give it a read.
If I may ask, can you show us the code you have that installs the ribbon? And which formatting is getting whacked?
One more thought popped into my mind after posting this. Years ago when I was in a corporate environment I customized the Project Global to include a series of macros (via custom icons). I hoped corporate would allow us to instill that customization into what was then the "base Global" used by all Project users but they didn't buy it so I ended up distributing the custom Global to all Project users in our group. This is along the same line that Dale proposed in his updated suggestion. As he said, just a thought.
John
- Gilgamesh1964Aug 29, 2022Brass ContributorHello
I won't actually provide all the code but here are key parts
I use the following to get to the CustomUI file
strFN=Environ("LocalAppData") & "\Microsoft\Office\MSProject.officeUI"
If the file does not exist then my code creates it.
I then treat this file as a simple text file, scan it to an appropriate place, and then insert my own xml code in for the new ribbons I'm adding such as
Print #intOutfile, "<mso:tab id=""MyTab"" label=""New Tab"">"
Print #intOutfile, "<mso:group id=""MyGroup"" label=""New Group"">"
Print #intOutfile, "<mso:control idQ=""mso:ChangeWorkingTime"" size=โโsmallโโ visible=""true""/>"
Print #intOutfile, "<mso:control idQ=""mso:TaskOutdent"" size=โโsmallโโ visible=""true""/>"
Print #intOutfile, "<mso:control idQ=""mso:TaskIndent"" size=โโsmallโโ visible=""true""/>"
Print #intOutfile, "</mso:group>"
Print #intOutfile, "</mso:tab>"
Between MS Project sessions it appeared that MS Project was rewriting the MSProject.officeUI file to add autoScale to the group and remove the size from the control such as
<mso:group id="MyGroup" label="New Group" autoScale="true">
<mso:control idQ="mso:TaskIndent" visible="true"/>"
Now this is where I need to apologise.
It has been some time since I last thought about this issue and I thought using an AutoExec style macro might help to rewrite the ribbon when MS Project starts. Hence the reason for my original post.
However, in the intervening time project has been patched a couple of times and it now appears that MS Project is not removing the formatting.
So I'm still curious as so methods of running code on starting MS Project (desktop version) but as far as the specific formatting problem I was having, that has been solved.
Thank you all for your assistance.