Microsoft KB Archive/147409

= PRJ: Toolbar Buttons Don't Work When Using DoEvents Statement =

Article ID: 147409

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Project 98 Standard Edition
 * Microsoft Project 4.0 Standard Edition
 * Microsoft Project 4.1 Standard Edition
 * Microsoft Project 4.0 for Macintosh

-



This article was previously published under Q147409



SYMPTOMS
When 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.



CAUSE
The 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 Sub If 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.



STATUS
This behavior is by design.

