PRJ: Toolbar Buttons Don't Work When Using DoEvents StatementLast reviewed: November 24, 1997Article ID: Q147409 |
The information in this article applies to:
SYMPTOMSWhen the DoEvents statement runs in a Visual Basic for Applications macro, toolbar button commands will not run. The toolbar buttons appear fully functional, but clicking a toolbar button will not run the command for that button. Menu commands, other macros, and other applications can be run normally.
CAUSEThe DoEvents statement can be used in a macro loop to enable user input to be processed while the macro waits for something specific to happen before continuing. For example, the following macro waits until the Gantt Chart view is active:
Sub WaitUntilGanttView() Do DoEvents Loop Until ActiveProject.CurrentView = "Gantt Chart" MsgBox "The Gantt Chart view is now active." End SubIf the Gantt Chart view is not active when this macro runs, the macro will stay in the DoEvents loop until the Gantt Chart view becomes active. While the DoEvents loop runs, none of the toolbar buttons will work.
STATUSThis behavior is by design.
REFERENCESFor more information about the DoEvents statement, choose the search button in Microsoft Project 4.0 Visual Basic Reference, and type the following:
DoEventsFor additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q118468 TITLE : Definition of DoEvents in Visual Basic for Applications |
Additional query words: 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |