The information in this article applies to:
SYMPTOMSWhen you use a For Each loop in an Visual Basic, Application Edition, macro in Microsoft Excel to loop through the assignments for a task or resource in Microsoft Project, you receive the following error message:
CAUSEThis problem occurs only if you run the macro from a Microsoft Excel module. WORKAROUNDTo work around this problem, use a For...Next loop with an integer variable to index the assignments collection. For example, use a macro in Microsoft Excel similar to the following:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. MORE INFORMATIONThe "For Each...Next" statement is a programming control structure in Visual Basic, Applications Edition, that is used to loop through a collection or list. For example, in the Visual Basic macro for Microsoft Excel below, the object variable "oAssmt" loops through the collection of assignments for task 1 of the active project in Microsoft Project, and is used to display the name of each resource assigned to task 1: NOTE: This code works correctly if it is run from a Microsoft Project module.
REFERENCESFor more information, see the "For Each...Next Statement" topic in Microsoft Project Visual Basic Reference Help. Additional query words: VB4
Keywords : projwin |
Last Reviewed: July 28, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |