5

I have two VBA macros that create a custom tab in MS Project 2013. The three macros are:

Private Sub Project_Open(ByVal pj As Project)
     AddEVMRibbon
End Sub

Private Sub removeEVMRibbon()
    ribbonXml = "<mso:customUI  xmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">" & "<mso:ribbon></mso:ribbon></mso:customUI>"
    ActiveProject.SetCustomUI (ribbonXml)
End Sub

Private Sub AddEVMRibbon()
Dim ribbonXml As String

    ribbonXml = "<mso:customUI xmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">"
    ribbonXml = ribbonXml + "  <mso:ribbon>"
    ribbonXml = ribbonXml + "    <mso:qat/>"
    ribbonXml = ribbonXml + "    <mso:tabs>"
    ribbonXml = ribbonXml + "      <mso:tab id=""macroTab"" label=""EVM"" insertAfterQ=""mso:TabFormat"">"
    ribbonXml = ribbonXml + "        <mso:group id=""testGroup"" label=""Test"" autoScale=""true"">"
    ribbonXml = ribbonXml + "          <mso:button id=""export_to_excel"" label=""Set EVM Calc Method"" "
    ribbonXml = ribbonXml + "imageMso=""DiagramTargetInsertClassic"" onAction=""Set_EVM_Method""/>"
    ribbonXml = ribbonXml + "          <mso:button id=""get_evm_method"" label=""EVM to Excel"" "
    ribbonXml = ribbonXml + "imageMso=""DiagramTargetInsertClassic"" onAction=""evm_to_excel""/>"
    ribbonXml = ribbonXml + "        </mso:group>"
    ribbonXml = ribbonXml + "      </mso:tab>"
    ribbonXml = ribbonXml + "    </mso:tabs>"
    ribbonXml = ribbonXml + "  </mso:ribbon>"
    ribbonXml = ribbonXml + "</mso:customUI>"

    ActiveProject.SetCustomUI (ribbonXml)

End Sub

These work correctly in MS Project 2013, but today I got the opportunity to run them with MS Project 2016, and they fail, rather spectacularly.

In both Project 2013 and 2016 the EVM Tab appears correctly and the two options, "Set EVM Method" and "EVM to Excel," appear when that custom tab is clicked.

In Project 2013 clicking on an option executes the VBA macro associated with the option in the XML. In Project 2016 simply hovering the mouse over either of the two options causes Project to fail immediately, giving me the "Microsoft Project has stopped working" then "Microsoft Project is restarting" messages.

I never have a chance to click the option, as it fails immediately when the cursor touches the option.

Has something changed between Project 2013 and 2016 that would cause this custom ribbon bar tab to fail in 2016? I have not been able to find anything referring to such a change.

Do custom tabs and their options in Project 2016 need to be coded differently than in 2013? Any and all help will be appreciated.

johnz
  • 489
  • 2
  • 17
  • I still have no answer to my question but today I ran these macros on another computer running MS Project 2016 and they worked just fine - no fatal error. I know today's computer had Project 2016 installed today, so I wonder if this is an updated version and the problem occurred on an earlier version of Project 2016. I will try to get the client to update Project 2016 to the latest version and see if that corrects the crashing problem described above. – johnz Mar 03 '17 at 02:55

1 Answers1

1

Updating project fixed the issue for me. The link below is to the current Project 2016 update. What exactly in the update fixed the problem is unknown. https://support.microsoft.com/en-us/help/4020152/may-9-2017-update-for-microsoft-office

Bellzz
  • 11
  • 3
  • 2
    Hello, and welcome to StackOverflow. Please edit your answer, expand to provide the solution - as link-only answers, if the link is dead in the future, are not any good. – Chait Jun 07 '17 at 00:18