What Is a Task Pane

The mark of good action is that it appears inevitable in retrospect. —Robert Louis Stevenson

To gather user input, Office developers typically display forms to be filled out by end users. There are disadvantages to this approach because it often forces users to attend to the form before they can continue working in the document. The form also obstructs users' view of the contents of the document. In this chapter, you will learn how to customize the Document Actions task pane to provide a rich user interface that is easily accessible, convenient, and dynamic.

If you've ever applied a style to a paragraph in Microsoft Office Word or searched for Help in Microsoft Office Excel, then you're already familiar with task panes. Word and Excel can present functionality to users by displaying controls such as text boxes, list boxes, and buttons on the task pane, which organizes related tasks so that users do not have to search through the menus to locate options. These applications have a number of built-in task panes to assist users in performing particular tasks. For example, Word presents a Styles and Formatting task pane where users can define and apply formatting to areas in the document. An Excel user can use the XML Source task pane to apply XML schemas and XML elements to a worksheet.

The task pane is actually a type of toolbar that can be docked along the side of a document. By default, the task pane displays vertically on the right side of the document or worksheet. End users can manually move the task pane so that it docks on the left side, the top, the bottom, or floating anywhere on the screen. To move the task pane, you select the upper-left area of the task pane, near the title, and drag the pane to the desired docking location. Because the task pane is really just a toolbar, you can programmatically access it through the CommandBars collection. For example, to dock the task pane to the bottom of the screen, you can set the Position property of the CommandBar called "Task Pane," as shown in Listing 5.1.

Listing 5.1. Docking the task pane to the bottom of the screen

Me.CommandBars("Task Pane").Position = _

Microsoft.Office.Core.MsoBarPosition.msoBarLeft

The 2007 Microsoft Office system has an application-level task pane called the custom task pane. You can customize this task pane when you create an add-in using VSTO SE. This is different from the document-level task pane which is only available to a particular document or template. In Chapter 14, you'll learn more about using VSTO 2005 SE to customize the application-level task pane. The remainder of this chapter discusses the document-level task panes that are customizable with VSTO.

0 0

Responses

  • gormadoc
    How to move the task pane in vba?
    8 years ago

Post a comment