PRJ41: "Out Of Memory" Adding Task or Resource in MacroLast reviewed: September 26, 1997Article ID: Q136880 |
The information in this article applies to:
SYMPTOMSIn Microsoft Project, when you use the Add method in a macro to add a task or resource to your project, you may receive the following error messages
Out of memory or system resourcesfollowed by:
Run-time error '7': Out of memory.Additionally, when you run a Visual Basic macro in another program and you use OLE Automation to add a task or resource to a project in Microsoft Project, you may receive the error messages described above.
CAUSEThis problem occurs if you use the Add method of the Tasks collection, or the Resource collection, without specifying a name argument. For example, if you run the following macro in Microsoft Project, you receive these error messages:
Sub Test() Projects(1).Tasks.Add End SubAlthough the Help topic for the Add method indicates that this argument is required, it also states that by default, the name argument is Empty. In Microsoft Project version 4.0, you can add a task or resource using the Add method without specifying a name argument. In this case, a task or resource is added without a task name or resource name.
RESOLUTIONTo avoid receiving an "out of memory" error message when you add a task to a project using a macro, include a value for the name argument, even if it is empty as in the following examples:
In Microsoft Project
Sub Test() ' Add task "Task1" Projects(1).Tasks.Add "Task1" End Sub-or-
Sub Test() ' Add blank task Projects(1).Tasks.Add "" End Sub Using OLE Automation
Sub Test() Dim x As Object, y As Object Set x = GetObject("", "MSProject.Application") x.FileNew Set y = x.Projects(1).Tasks.Add "" End Sub STATUSMicrosoft 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 INFORMATIONNote that when you run a Visual Basic macro in another program and you access Microsoft Project as an OLE Automation object, if you receive the "Run-time error '7':" error message as described above, the error message may contain question mark characters such as "?4????" instead of the "out of memory" text. For additional information, please see the following article(s) in the Microsoft Knowledge Base:
ARTICLE-ID: Q136881 TITLE : OLE Automation Run-Time Error Message Contains Question Marks REFERENCESFor more information about using the Add method to add a task or resource in Microsoft Project, click the Index tab in Microsoft Project Help, type the following text
adddouble-click the selected text, and then double click "add method" to go to the "Add Method" topic.
|
Additional query words: 4.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |