Article ID: 131847 - Last Review: October 11, 2006 - Revision: 2.3 Creating a PAUSE Button in Visual Basic for ApplicationsThis article was previously published under Q131847 SUMMARY
In Visual Basic, Applications Edition, there is no built-in equivalent for
the MS Excel 4.0 PAUSE() macro function. The Visual Basic code in this
article provides an alternative.
You might want to use this code to pause execution of your macro while a user enters data directly in a sheet or manipulates menus. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Microsoft Excel does not have a "Macro Paused" Toolbar that can be
invoked by a single command. This is true even when you run an MS Excel 4.0
macro.
The following Visual Basic code comprises two sub procedures that you can modify to create the effect of pausing a macro. If you have a single procedure within which you need to pause execution until the user desires to resume execution, split your sub procedure into two halves. On the last line of the first half of the sub procedure, call the "First_Half" sub procedure. Within the "Second_Half" sub procedure, substitute the name of the sub procedure that is the second half of your original sub procedure on the line where the MsgBox is currently located. REFERENCES
For more information, see the Visual Basic User's Guide, Chapter 12,
"Managing Toolbars and Toolbar buttons with Visual Basic"
| Article Translations
|

Back to the top
