Microsoft KB Archive/113818

From BetaArchive Wiki

Error Running Macro with Recorded Next Window Command

PSS ID Number: Q113818 Article last modified on 11-16-1994

4.00

WINDOWS

The information in this article applies to:
- Microsoft Project for Windows, version 4.0

SYMPTOMS

In Microsoft Project, if you turn on the macro recorder, and choose Next Window from the Document Control menu, when you run the macro, one of the following happens:

  • The wrong project window is selected

    -or-

  • You receive the following error message:

    Run-time error ‘1004’:

    Command could not be completed successfully.

CAUSE

When you turn on the macro recorder, and choose Next Window from the Document Control menu, the command that is recorded in the macro is WindowActivate with the WindowName argument equal to the name of the window that you activated. Because of this behavior, when you run the macro again, the macro either activates the window that was activated when you recorded the macro, or returns an error stating that the window could not be found.

WORKAROUND

To correct this behavior, edit the recorded macro: enter the WindowNext command in place of the WindowActivate command.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In a new project (Project1), choose New from the File menu to open a new project (Project2).
  2. From the Tools menu, choose Record Macro.
  3. In the Macro Name box, type “Next_Window” (without the quotation marks). Choose the Options button, and under Store Macro In, select the Current Project File option. Choose OK.
  4. From the Document Control menu, choose Next Window.
  5. From the Tools menu, choose Stop Recorder.
  6. From the Tools menu, choose Macros. From the Macro Name list, select Next_Window and choose Edit.

The macro contains the WindowActivate command with the WindowName argument equal to the name of the window that was activated (Project1).

REFERENCES

For more information about the WindowNext Method, choose the Search button in the Visual Basic Reference and type:

WindowNext

KBCategory: kbusage KBSubcategory:

Additional reference words: 4.00

Copyright Microsoft Corporation 1994.