Table of contents
TOC
Collapse the table of content
Expand the table of content

Project.SetCustomUI Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Sets the internal XML value for a custom ribbon user interface of the project.

Syntax

expression. SetCustomUI( ** CustomUIXML** )

expression An expression that returns a Project object.

Parameters

NameRequired/OptionalData TypeDescription
CustomUIXMLRequiredStringValid XML data for modifying the ribbon.

Return Value

Nothing

Remarks

Because Project uses a binary file format, the SetCustomUI method is required for programmatically customizing the ribbon.

Note The SetCustomUI method affects all customizations within the scope of the project. For example, if there is an existing customization in the the enterprise global project or the local Global.mpt project, to make an additional customization, you must include the existing XML definition in the CustomUIXML argument.

The CustomUIXML value must be valid XML for Microsoft Office custom ribbon content. The XML value must begin with the mso:customUI element, followed by the mso:ribbon element. If the mso:ribbon element is empty, SetCustomUI removes ribbon customizations.

There are many articles on MSDN about customizing the ribbon for the Fluent user interface in Microsoft Office applications. For more information, see Office Fluent User Interface Developer Portal.

Example

The following example adds New Tab to the left of the VIEW tab in the ribbon. New Tab contains a group named New Group. The button in the group is named Test Button and uses the image named GetExternalDataFromText in the built-in Microsoft Office icon library.

Sub AddCustomUI() 
    Dim customUiXml As String 

    customUiXml = "<mso:customUI xmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">" _
        &; "<mso:ribbon><mso:tabs><mso:tab id=""myTab"" label=""New Tab"" " _
        &; "insertBeforeQ=""mso:TabView"">" _ 
        &; "<mso:group id=""group1"" label=""New Group"">" _ 
        &; "<mso:button id=""button1"" label=""Test Button"" size=""large"" " _
        &; "imageMso=""GetExternalDataFromText"" />" _ 
        &; "</mso:group></mso:tab></mso:tabs></mso:ribbon></mso:customUI>" 

    ActiveProject.SetCustomUI (customUiXml) 
End Sub

The following example removes all ribbon customizations, because the mso:ribbon element is empty.

Sub RemoveCustomUI() 
    Dim customUiXml As String 

    customUiXml = "<mso:customUI xmlns:mso=""http://schemas.microsoft.com/office/2009/07/customui"">" _
        &; "<mso:ribbon></mso:ribbon></mso:customUI>" 

    ActiveProject.SetCustomUI (customUiXml) 
End Sub
© 2017 Microsoft