Working With The Excel Object Model

BxUtt

You can capture the results of a button pressed on a displayed dialog box by assigning the Show property statement to a variable. The value of this variable is True if the user clicks OK, and False if the user clicks Cancel in the dialog box.

Excel has over 240 different dialog boxes that display throughout its application. You can display any of these dialog boxes using the appropriate constant. The following table lists a few of the most commonly used Excel dialog boxes:

CONSTANT

DISPLAYS

xlDialogFIleDelete

The Delete dialog box, where you select files to remove.

xlDialogInsert

The Insert dialog box for adding additional cells to a worksheet.

xlDialogNew

The New Document task pane.

xlDialogOpen

The Open dialog box.

xlDialogPrint

The Print dialog box.

xlDialogSaveAs

The Save As dialog box.

I File Edit View Insert Format Debug Run lools Add-Ins Window Help

H a - D JS * ® « *> " . II ■ M a <S * B) Lna.coll

I File Edit View Insert Format Debug Run lools Add-Ins Window Help

H a - D JS * ® « *> " . II ■ M a <S * B) Lna.coll

S Switch to Excel and run theOpen_DialogBox()

macro.

-Q Type .Show "Expenses", "2000 Expenses"

replacing "Expenses" and "2000 Expenses" with the arguments associated with the selected dialog box.

S Switch to Excel and run theOpen_DialogBox()

macro.

!I§P) File Edit View I

General Sum

nary | statistics | Contents

Custom J

Type

question for help » _ B

*

1 □

iQS

® i

n |100% -1 Bj .

-ridl "il

F tu*

A15

Subject:

2000 Expenses

A I E

Author:

H

1

J

K

1

2

Rent

Manager:

3

January

$75

Company:

il ,411 00

4

February

149;

R

Category:

1509

7

575

Keywords:

11,722 00

H

June

9

July

Comments:

10

August

11

September

Hyperlink

12

October

13

November

Template:

14

December

16

T~ Save preview picture

17

18

.,«1

1b

20

21

22

23

24

25

-

H

* n|\ Sheet2 I Sheet3 ^Sheet1 /

1

1

Ready

-■ The Properties dialog box displays with the specified argument in the appropriate fields on the dialog box.

Was this article helpful?

0 0

Post a comment