XL97: How To Display a Progress Bar with a UserFormLast reviewed: January 9, 1998Article ID: Q170782 |
The information in this article applies to:
Article idea submitted by: John Walkenbach
SUMMARYIf you have a Visual Basic for Applications macro that requires a long period of time to complete, you may want to give your user an indication that the macro is progressing normally. This article contains an example that illustrates how to create a progress bar with a UserForm.
MORE INFORMATIONIn the following example, a Visual Basic subroutine populates a large range of cells with a random number. This task will take several seconds to complete; the indicator gives you an indication that the macro is running normally. Microsoft provides examples of Visual Basic for Applications procedures 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. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.
Create the UserForm
Enter the Macro Code
The ShowUserForm subroutine shows the UserForm. The procedure attached to the Activate event of the UserForm calls the Main subroutine. The Main subroutine, in addition to its main task (populating cells with random numbers), calls the UpdateProgressBar subroutine, which updates the Label control on the UserForm. NOTE: Using this technique, your macro will take just a bit longer to complete its intended task(s).
REFERENCESFor more information about the Activate event, click the Office Assistant in the Visual Basic Editor, type "activate event," click Search, and then click to view "Activate, Deactivate Events." NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q120802 TITLE : Office: How to Add/Remove a Single Office Program or Component |
Additional query words: XL97
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |