Microsoft KB Archive/32867

-

{| 2.x 3.x 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, and 3.0

SUMMARY
When a custom dialog box is terminated with the Cancel button, the value returned by the dialog box function is FALSE. The value will be returned on the macro sheet in the cell containing the dialog box function, not in the init/result column for the Cancel button in the dialog box definition area.

MORE INFORMATION
To perform additional processing based on whether or not the Cancel or OK button was pressed in the dialog box, interrogate the =DIALOG.BOX statement in the macro using an IF statement such as the following, where Cell A2 contains =DIALOG.BOX and Cells A24 and B34 are other statements in a macro or subroutines:

=IF(A2<>false,GOTO(A24),GOTO(B34)) This statement will cause the control of the macro to jump to Cell A24 and continue executing if the OK button is pressed in the dialog box, or to jump to Cell B34 if the Cancel button is pressed.