New File Object

Microsoft Office XP applications contain a new feature known as a task pane. A task pane is a dialog box docked within the host application (see Figure B-1). This dialog box can contain one or more pages broken into sections. For example, the New Workbook page in Excel 2002 contains the following five sections: Open a workbook, New, New from existing workbook, New from template, and an unnamed section at the bottom of the task pane. The NewFile object represents a new document that can be listed in the task pane. To access the NewFile object in Excel, use the NewWork-book property. The following procedures demonstrate how to add and remove a workbook from the New from existing workbook section of the task pane:

Sub AddToTaskPane()

Application.NewWorkbook.Add _

Filename: = "C:\BlueGnd.xls", _ Section:=msoNewfromExistingFile, _ DisplayName:="New Blue Grid", _ Action:=msoCreateNewFile CommandBars("Task Pane").Visible = False CommandBars("Task Pane").Visible = True End Sub

Sub RemoveFromTaskPane()

Application.NewWorkbook.Remove _ Filename: = "C:\BlueGnd.xls", _ Section:=msoNewfromExistingFile, _ DisplayName:="New Blue Grid" CommandBars("Task Pane").Visible = False CommandBars("Task Pane").Visible = True End Sub

,0 Microsoft Excel - Special.xls

HEB

U Eile £dt yiew insert Farmal lools

DöQ^aßy ¡k Ssv

Qate Window

E 5 5 m

$ % , td! 9 »

j Tatos .11 t ||fl [.I y i

A1 « T* Student Natna I

A

B

C

l:

New Workbook * x

1

| Student Name

1Scores

Open a workbook

Ann Matlnrk

133

BlueGrid.xls AddB.xls Special, xb Shopping, txt SSr More workbooks,.. New

3

lohn Brick

248

4

Adam Bryan

187

5

Micky Mack

345

B

Tonya Walsh

149

7

Q Blank Workbook

e

9

i^) Choose workbook,.. New Blue Grid New from template

1D

*

11

12

13

Templates on rny Web 5ltes... j Templates onMicrosoft.com

14

15

Ifi

-■ - •> ■ , . ,

Draw- fe AytoSliapes" - Q O H 41 0 ¡13 £

* - £ - a . = H ■ ■ .

Ready

A

Figure B-1: You can programmatically add files to the New Workbook page of the task pane.

0 0

Post a comment