How to Use Multiple OK Buttons in an Excel Dialog BoxLast reviewed: November 2, 1994Article ID: Q40185 |
The information in this article applies to:
SUMMARYIf you use multiple OK buttons in a user-defined dialog box in Microsoft Excel (dialog item numbers 1 and 3), your macro should check the DIALOG.BOX line to see what number was returned. If that cell returns a FALSE value, then a Cancel button was chosen; otherwise, the cell returns an integer. The number represents the position of the OK button in the dialog box definition table, beginning with the second line in the table.
MORE INFORMATIONWhen you run the following example, a dialog box that contains three buttons is displayed on the screen. If you choose the first one, cell A2 returns the number 1 because the first button is the second item in the dialog box definition table. If you choose the second button, which is a Cancel button, then cell A2 returns the value FALSE. If you click the third button, then cell A2 returns the number 3. A1: Button_Macro A2: =DIALOG.BOX(B3:H5) A3: =RETURN()
B2: item C1: x D1: y E1: width F1: height G1: text H1:init/result B3: 12 C2: 0 D2: 0 E2: 165 F2: 100 G2: H2: B4: 1 C3: 20 D3: 15 E3: 120 F3: 21 G3: Default OK H3: B5: 2 C4: 20 D4: 40 E4: 120 F4: 21 G4: Cancel H4: B6: 3 C5: 20 D5: 65 E5: 120 F5: 21 G5: OK H5:Note that in Microsoft Excel version 5.0, you can also use a Dialog sheet to create a user-defined dialog box with multiple OK buttons. For more information about dialog box controls in Microsoft Excel version 5.0, see Chapter 11, "Controls and Dialog Boxes," in the "Microsoft Excel Visual Basic User's Guide".
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |