Microsoft KB Archive/40185

-

{| 2.x 3.00 4.00 5.00 | 2.20 2.21 3.00 WINDOWS           | OS/2 kbusage The information in this article applies to:
 * width="100%"|


 * Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0
 * Microsoft Excel for OS/2, versions 2.2, 2.21, and 3.0

SUMMARY
If 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 INFORMATION
When 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, &quot;Controls and Dialog Boxes,&quot; in the &quot;Microsoft Excel Visual Basic User's Guide&quot;.
 * }

-

Last reviewed: November 4, 1994

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.