PDA

View Full Version : Macro callback not working on XML custom tab



peetman
07-13-2017, 07:27 AM
I'm creating a custom tab in MS Project using VBA and XML. On the ProjectGlobal I have the following:


Inside ThisProject(Global.MPT)



Private Sub Project_Activate(ByVal pj AsMSProject.Project)


ribbonXml ="<mso:customUI xmlns:x1=""htp://schemas.microsoft.com/office/2009/07/customui/macro"" xmlns:mso=""htp://schemas.microsoft.com/office/2009/07/customui"">"
ribbonXml = ribbonXml +"<mso:ribbon>"
ribbonXml = ribbonXml +"<mso:qat/>"
ribbonXml = ribbonXml +"<mso:tabs>"
ribbonXml = ribbonXml +"<mso:tab id=""mso_c1.497B55B8"" label=""Produtos Novos"">"
ribbonXml = ribbonXml +"<mso:group id=""mso_c2.497B55B8"" label=""New Product"" imageMso=""ViewGoForward"" autoScale=""true"">"
ribbonXml = ribbonXml +"<mso:button idQ=""x1:newProjectPN"" label=""New Project (NOK)"" imageMso=""CategoryCollapse"" onAction=""newProjectPN"" visible=""true"" />"
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

Then I have a module with the following

Public Sub newProjectPN(Control As IRibbonControl)

MsgBox"Not working yet. Please be patient "

End Sub


It creates the tab with the button as expected, but when I click the button it does nothing. How do I reference the macro in XML strings?