none
Runtime error when running macro from project in project server/pwa versus MS Project File RRS feed

  • Question

  • I loaded a project .mpp into our Project Web App environment and cannot get a key macro we developed to execute from the button we added to the ribbon for quick execution.  Now when we hit the button we get a runtime error.  If we execute the macro from the VBA editor, it runs fine.  If we move the module the macro is in to the Global.mpt it runs from the button on the ribbon.  If I open the enterprise global, use the organizer to move the module into the enterprise global, after I close and check the enterprise global in, the module doesn't appear to be in the enterprise global on re-open.  Not exactly sure why we are getting these behaviors.  Can you help?
    Thursday, August 9, 2018 6:48 PM

All replies

  • Hi,

    I assume you use a cutomizes ribbon (File - Options - .... In this way, you can't access macros in EGlobal. To customize your ribbon for EGlobal macros, you need to adjust your ribbin by code.

    Here a simple sample:

    Sub TestRibbon()
    Call AddCustomTabToRibbon(ActiveProject)
    End Sub
    Sub AddCustomTabToRibbon(pj As Project)
    On Error GoTo CTError
      MRXActions = ""
      
      MRXActions = MRXActions + "<mso:group id=""MGGroup1"" label=""Group1"" autoScale=""true"">"
      MRXActions = MRXActions + "  <mso:button id=""MBButton1"" "
      MRXActions = MRXActions + "    label=""Button1 label"" "
      MRXActions = MRXActions + "    size=""large"" imageMso=""OutlineExpand"" "
      MRXActions = MRXActions + "    screentip=""Button1 screentip"" "
      MRXActions = MRXActions + "    supertip=""Button1 supertip"" "
      MRXActions = MRXActions + "    onAction=""MacroName1""/>"
      
      MRXActions = MRXActions + "  <mso:button id=""MBButton2"" "
      MRXActions = MRXActions + "    label=""Button2 label"" "
      MRXActions = MRXActions + "    size=""large"" imageMso=""CellsInsertDialog"" "
      MRXActions = MRXActions + "    screentip=""Button2 Screentip"" "
      MRXActions = MRXActions + "    supertip=""Button2 supertip"" "
      MRXActions = MRXActions + "    onAction=""MacroName2""/>"
      MRXActions = MRXActions + "</mso:group>"
      
      MRXActions = MRXActions + "<mso:group id=""MGGroup2"" label=""Group2"" autoScale=""true"">"
      MRXActions = MRXActions + "  <mso:button id=""MBButton3"" "
      MRXActions = MRXActions + "    label=""Button3 label"" "
      MRXActions = MRXActions + "    size=""large"" imageMso=""ExportWord"" "
      MRXActions = MRXActions + "    screentip=""Button3 screentip"" "
      MRXActions = MRXActions + "    supertip=""Button3 Supertip"" "
      MRXActions = MRXActions + "    onAction=""MacroName3""/>"
      
      MRXActions = MRXActions + "  <mso:button id=""MBButton4"" "
      MRXActions = MRXActions + "    label=""Button4 label"" "
      MRXActions = MRXActions + "    size=""large"" imageMso=""CloseDocument"" "
      MRXActions = MRXActions + "    screentip=""Button4 screentip"" "
      MRXActions = MRXActions + "    supertip=""Button4 Supertip"" "
      MRXActions = MRXActions + "    onAction=""MacroName4""/>"
      
      MRXActions = MRXActions + "  <mso:button id=""MBButton5"" "
      MRXActions = MRXActions + "    label=""Button5 label"" "
      MRXActions = MRXActions + "    size=""large"" imageMso=""CheckNames"" "
      MRXActions = MRXActions + "    screentip=""Button5 screentip"" "
      MRXActions = MRXActions + "    supertip=""Button5 Supertip"" "
      MRXActions = MRXActions + "    onAction=""MacroName5""/>"
    
      MRXActions = MRXActions + "</mso:group>"
    
      
      CustomXML = ""
      CustomXML = CustomXML + "<mso:customUI xmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">"
      CustomXML = CustomXML + "  <mso:ribbon startFromScratch=""false"">"
      'CustomXML = CustomXML + "    <mso:qat/>"
      CustomXML = CustomXML + "    <mso:tabs>"
      CustomXML = CustomXML + "      <mso:tab id=""MTCustTab"" label=""My Custom Tab"" insertBeforeQ=""mso:TabFormat"">"
      
      CustomXML = CustomXML + MRXActions
       
      CustomXML = CustomXML + "      </mso:tab>"
      CustomXML = CustomXML + "    </mso:tabs>"
      CustomXML = CustomXML + "  </mso:ribbon>"
      CustomXML = CustomXML + "</mso:customUI>"
      
        
      '-------------------- reset ribbon --------------------
      
      pj.SetCustomUI ("")
      pj.SetCustomUI (CustomXML)
    
      Exit Sub
    CTError:
      MsgBox "Ribbon could not be created", vbInformation, "No customized ribbon"
    End Sub
    

    instead of using TestRibbon for testing purposes, call AddCustomTabToRibbon e.g. on open of a project.

    Does that help?

    Barbara

    • Proposed as answer by zigune Wednesday, October 23, 2019 1:56 PM
    Thursday, August 16, 2018 4:41 PM
    Moderator
  • Thank you Barbara,

    but can you tell me where I can find the code I have to put in the MRXActions variable in order to have it like the ribbon I want ?

    zigune

    Wednesday, October 23, 2019 6:37 AM
  • Mmmmhhh,

    it seems that by exporting the ribbon I can have something interesting for your macro...

    zigune

    Wednesday, October 23, 2019 6:44 AM
    • Proposed as answer by zigune Wednesday, October 23, 2019 1:56 PM
    Wednesday, October 23, 2019 9:17 AM
    Moderator
  • Hello,

    many thanx. Yes I am trying to do it for the moment but it's a good starting point !

    zigune

    Wednesday, October 23, 2019 1:56 PM