Customizing an Existing Tab
If you have just a few macros that require an interface, building a new tab is probably overkill. Instead, you can add controls for those macros to one of the application's built-in tabs. To work with a built-in tab, you again use the <tab> element, but the syntax is slightly different. Here's a simplified version:
<tab idMso="ID" visible="true|false" />
ID
The unique string identifier for the built-in tab.
The value of the idMso attribute takes one of the following forms:
- TabName-This is the most common form and it's used for most regular built-in tabs. Here, Name is the name that appears on the tab, with spaces and punctuation marks (such as dashes) removed. For example, the isMso value for Word's Insert tab is TabInsert, and the value for PowerPoint's Slide Show tab is TabSlideShow.
- TabContextName-This is the form used for contextual tabs (the tabs that appear only when you select certain objects, such as pictures or tables). Here, Context is the overall name of the contextual tabs and Name is the name of the specific contextual tab. For example, when you click a picture object, you see the Picture Tools tab and the Format tab. So the isMso value for the Format tab is TabPictureToolsFormat.
- TabNameApplication-This is the form used for tabs that are common to multiple applications. Here, Name is the name of the tab and Application is the name of the application. So the isMso value for Word's Page Layout tab is TabPageLayoutWord, whereas the value for Excel's Page Layout tab is TabPageLayoutExcel.
Unfortunately, there are lots of exceptions to the various tab naming conventions. For example, even
though the View tab is common to Word, Excel, and PowerPoint, its idMso value is TabView in all
the programs.The only way to be sure of the correct idMso values is to download Microsoft's Lists
of Control IDs, a collection of Excel worksheets that provide the idMso values for every interface
element. Go to the following site and search for "lists of control ids":
http://www.microsoft.com/downloads/
You'll work with built-in tabs in more detail later in this tutorial when you learn how to add groups and controls to existing tabs. For now, you can use the visible attribute to hide built-in tabs that you don't want the user to see. For example, the following XML code hides the Developer tab:
<tab idMso="TabDeveloper" visible="false" />
In this tutorial:
- Customizing the Office 2007 Ribbon
- Understanding Ribbon Extensibility
- Extending the Ribbon: An Example
- Step 1: Create a Macro-Enabled Office Document or Template
- Step 2: Create a Text File and Add the Custom XML Markup
- Step 3: Copy the Custom XML Markup File to the Document Package
- Step 4: Rename and Open the Document
- Hiding the Built-In Ribbon
- Creating Custom Tabs
- Customizing an Existing Tab
- Creating Custom Groups
- Customizing an Existing Group