Creating Fast Commands in the Office 2010 Backstage View

Office 2010

Office Quick Note banner

Getting Started with Office 2010 Fluent UI Customization: Learn how to create Fast commands on the Microsoft Office Backstage view user interface.

Last modified: June 21, 2011

Applies to: Excel 2010 | Office 2010 | PowerPoint 2010 | Word 2010

In this article
Create the Documents
Add XML to the Document to Create the Tab
Add Code to Give the Command Functionality
Test the Solution
Next Steps

Published:   August 2010

Provided by:    Frank Rice, Microsoft Corporation

In this exercise, you create a Fast command button on the Microsoft Office Backstage view user interface (UI). The command loads a template instance into a Microsoft Word 2010 document. To complete this task, you must do the following:

This exercise uses the Custom UI Editor to edit the test document. Find the tool at

In this task, you create a test document in Word 2010 that is updated with the XML to create the Fast command. You also download the resume template that is loaded when you click the command button.

To create the Word 2010 documents

  1. Start Word 2010 and on the Quick Access Toolbar, click Save.

  2. In the File name box, type Fast Command, and in the Save as type drop-down list, click Word Macro-Enabled Document (*.docm), and then click Save.

  3. Next, you create the document that is loaded into the test document when you click the Fast command. In the current document, click the File tab, and then click New.

  4. Scroll down and then click Resumes and CVs.

  5. In the Basic Resumes folder, click any resume template, and then click Download.

  6. Click the File tab, and then click Save As.

  7. In the File name box, type MyResume, and in the Save as type drop-down list, click Word Template (*dotx), and then click Save.

  8. Close the document.

In this task, you use the Custom UI Editor to add XML markup code to the document that creates the Fast command button.

To add XML to the test document

  1. Start the Custom UI Editor, and then on the File menu, click Open.

  2. Navigate to the test document that you create previously, and then click Open.

  3. On the Insert menu, click Office 2010 Custom UI Part.

  4. On the navigation pane, click the customUI14.xml.

  5. In the code window, add the following code.

    <?xml version="1.0" encoding="utf-8" ?>
    <customUI xmlns="" >
          <button id="saveBtn" label="Load &amp;&amp; Return" imageMso="SourceControlCheckIn" keytip="Z" insertAfterMso="FileSaveAs" onAction="OnAction" isDefinitive="true" /> 
  6. This code has several actions occurring. First, it adds a button to the Backstage view. It also shows how to include ampersands into the label name by escaping the &amp; token with another &amp; token. The button uses a built-in image as denoted by the imageMso attribute. The code assigns a keytip and specifies where it will be inserted into the Backstage view (after the built-in Save As command) by using the insertAfterMso attribute. The onAction attribute specifies the macro that is executed when you click the button. And finally, setting the isDefinitive attribute to true closes the Backstage view and returns you to the document when you click the button.

  7. On the toolbar, click Validate and correct any errors.

  8. Save and then close the Custom UI Editor.

In this task, you add Microsoft Visual Basic for Applications (VBA) code to the test document that loads an instance of the resume template.

To add VBA code to the test document

  1. Open the test document, and then on the Developer tab, click Visual Basic.

  2. On the Insert menu, click Module.

  3. Add the following code in the code window.

    Sub OnAction(control As IRibbonControl)
        Dim wdApp As Word.Application
        Set wdApp = GetObject(, "Word.Application")
        wdApp.Documents.Open FileName:="C:\< your path here>\MyResume.dotx", ReadOnly:=True, AddtoRecentFiles:=False
    End Sub
  4. Close the VBA editor.

In this task, you test the solution by clicking the Fast command button and uploading the resume template.

To upload the resume document

  1. Click the File tab, click Sample Tab, and then click Load & Return as shown in Figure 1.

    Figure 1. Load & Return command

    Load and Return command

    The Backstage view closes and the resume is loaded into an instance of the template document.

  2. Close the document.