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

Last reviewed: November 24, 1997
Article ID: Q147409
The information in this article applies to:
  • Microsoft Project 98 for Windows
  • Microsoft Project for Windows, versions 4.0, and 4.1
  • Microsoft Project for the Macintosh, version 4.0

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:

   ARTICLE-ID: Q118468
   TITLE     : Definition of DoEvents in Visual Basic for Applications


Additional query words: 4.00
Keywords : kbcode kbprg kbcode kbprg
Version : 4.00 4.10 | 4.00
Platform : MACINTOSH WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.