Microsoft KB Archive/108188

{| = Excel: Macro to Display Message Box While Another Macro Runs =
 * width="100%"|

Last reviewed: June 30, 1997

Article ID: Q108188 The information in this article applies to:
 * Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a

SUMMARY
It is possible to display a dialog box while a macro runs in the background. One use for this dialog box would be to display a "wait" message while a macro is running.

MORE INFORMATION
The following dialog box definition table contains an OK button set as a trigger (item number 101). This OK button is not within the viewing area of the dialog box. While a button is a trigger, screen redrawing does not occur immediately. The ENTER key command (line 3 of the macro below) will be sent before the dialog box is run and will choose the OK button as it appears. The dialog box, therefore, neither requires nor accepts user interaction.

Microsoft provides macro examples for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This macro is provided 'as is' and Microsoft does not guarantee that the following code can be used in all situations. Microsoft does not support modifications of the code to suit customer requirements for a particular purpose.

The following dialog box will display a "Please Wait" message as the macro is run.

Dialog Box Definition Table

C1:     D1:     E1:     F1: 114  G1: 26  H1:                I1: C2: 5   D2: 10  E2: 6   F2:      G2:     H2: Please Wait .. I2: C3: 101 D3: 14  E3: 62  F3:  88  G3:     H3: OK             I3:

Macro Code
A1: Wait_Box A2: =ECHO(FALSE) A3: =SEND.KEYS("~") A4: =DIALOG.BOX(C1:I3) A5: A6: =RETURN