Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
INFO: Customizing the Microsoft Office XP Task Pane
Article ID: 288542 - View products that this article applies to.
This article was previously published under Q288542
Microsoft Office XP contains a new feature called the Task Pane. A Task Pane is a dockable dialog window that gives users a convenient way to use commands, gather information, and modify their documents. An Office Task Pane can contain one or more pages, and each page is broken up into sections.
Developers can programmatically manipulate the Task Pane to perform certain functions such as view the pane, dock or undock the window, and add custom information to the New Item page that is common among all Office XP applications.
The Office XP Task Pane is a special type of dockable CommandBar object. Only one task pane exists in each Office application and it can be accessed through the CommandBars collection under the name TaskPane. This CommandBar has a single control, which represents the active page. You can access a limited number of properties for the page by using this CommandBarControl. For example, to display the name for the current page in the Task Pane, you can use code such as the following:
In addition, most CommandBar customizations such as docking, height, width, and so forth, can be performed on the Task Pane itself. However, there are several things you cannot do with the Task Pane CommandBar object. Here are a few examples:
Add Items to the New Item Task Pane PageThere is one Task Pane page that every Office XP application implements: the New Item page. This page corresponds to the File New dialog box in previous versions of Office. Office XP allows you to add or remove items on this page so that documents or templates you use most often can be added for quick reference. To do this programmatically, use the NewFile object that is exposed by each Office application.
To access the NewFile object, use one of the following properties that are available from the Application object. The property names differ depending on which Office application you are working in:
The NewFile object exposes two methods, Add and Remove, which let you add and remove specific items into sections on the File New page for that Office application. For example, the following code creates a new entry in the "New Document" section for Word's File New Task Pane page:
After you run this code, there is a new entry in the "New Document" Task Pane page that, when clicked, opens the file C:\NewDocument.doc. Following is equivalent code for Microsoft Excel 2002:
NOTE: Toggle the Visible property of the Task Pane to refresh the view. If the Task Pane is visible while the New Item page is active, any changes you make through code are not seen until it is hidden and then made visible again.
You can add items to New Item pages in the other Microsoft Office XP applications as well. If you are automating the Task Pane to suit a custom application, be sure to remove any items you add by using the Remove method when they are no longer needed. The new items you add persist for that user after the application is closed.
For more information on using the Task Pane, see the Visual Basic for Applications (VBA) Online Help for the NewFile Object.