Consulting

Results 1 to 3 of 3

Thread: Remove a custom group/button from the ribbon

  1. #1

    Remove a custom group/button from the ribbon

    I have a macro in MS Project 2010 that I would like to run from a button in the ribbon. So far, so easy: just add a custom group and a custom button in the ribbon customiser. However, I want to add some code that will a) add a similar button when other users open the file; and b) remove that customisation first (if it already exists) before then adding the button back. This question is about the second part - clearing customisation (or at least this specific button - the button is called "Export Reporting Data" and is in the custom group "Reporting").

    From Microsoft I got the following, which purports to clear all customised elements:

    Sub RemoveCustomUI()     
    Dim customUiXml As String      
    
    customUiXml = "<mso:customUIxmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">" _        
      & "<mso:ribbon></mso:ribbon></mso:customUI>"      
    
    ActiveProject.SetCustomUI (customUiXml) 
    
    End Sub
    However, this doesn't work for me in Project 2010. Can anyone help please? Thank you...

    MJ
    Last edited by JBSMichael; 12-10-2018 at 09:34 AM.

  2. #2
    MS Excel MVP VBAX Mentor Andy Pope's Avatar
    Joined
    May 2004
    Location
    Essex, England
    Posts
    335
    Location
    I don't have Project in order to test but I think the issue is a missing space in the string you generate.
    You need to seperate customUIxml from the start of the schema namespace,
    mso:customUIxml ns:mso

    Sub RemoveCustomUI()     
    Dim customUiXml As String      
    
    customUiXml = "<mso:customUIxml ns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">" _        
      & "<mso:ribbon></mso:ribbon></mso:customUI>"      
    
    ActiveProject.SetCustomUI (customUiXml) 
    
    End Sub
    Cheers
    Andy

  3. #3
    Thanks so mich for taking the time Andy. Iíll give it a go and let you know how I get on.

    Mike

    Quote Originally Posted by Andy Pope View Post
    I don't have Project in order to test but I think the issue is a missing space in the string you generate.
    You need to seperate customUIxml from the start of the schema namespace,
    mso:customUIxml ns:mso

    Sub RemoveCustomUI()     
    Dim customUiXml As String      
    
    customUiXml = "<mso:customUIxml ns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">" _        
      & "<mso:ribbon></mso:ribbon></mso:customUI>"      
    
    ActiveProject.SetCustomUI (customUiXml) 
    
    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •