Excel: Macro to Display Message Box While Another Macro Runs

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: <your macro code here> A6: =RETURN()

REFERENCES

"User's Guide," version 3.0, pages 624-641. "Function Reference," version 3.0, page 57 "User's Guide," version 4.0, pages 263-282 "Function Reference," version 4.0, pages 112-113


Additional query words: 4.00 3.00 4.00a alert
Keywords : kbmacro kbprg kbprb
Version : 3.00 4.00 4.00a
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.