PRJ: Toolbar Buttons Don't Work When Using DoEvents Statement (147409)



The information in this article applies to:

  • Microsoft Project 98 for Windows
  • Microsoft Project for Windows 4.0
  • Microsoft Project for Windows 95 4.1
  • Microsoft Project for the Macintosh 4.0

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.

REFERENCES

For more information about the DoEvents statement, choose the search button in Microsoft Project 4.0 Visual Basic Reference, and type the following:

DoEvents

For additional information, please see the following article in the Microsoft Knowledge Base:

118468 XL: Definition of DoEvents in Visual Basic for Applications


Modification Type:MajorLast Reviewed:11/25/2003
Keywords:kbcode kbprb kbProgramming KB147409