Microsoft KB Archive/242723

= Error message when you run a macro that assigns a material resource in Project: "Run-Time Error 1101. The argument value is not valid" =

Article ID: 242723

Article Last Modified on 1/25/2007

-

APPLIES TO


 * Microsoft Office Project Professional 2007
 * Microsoft Office Project Standard 2007
 * Microsoft Office Project Professional 2003
 * Microsoft Office Project Standard 2003
 * Microsoft Project 2002 Professional Edition
 * Microsoft Project 2002 Standard Edition
 * Microsoft Project 2000 Standard Edition

-



This article was previously published under Q242723



SYMPTOMS
In Microsoft Project, when you run a Microsoft Visual Basic for Applications macro that assigns a material resource, you may receive the following error message:

Run-time error '1101':

The argument value is not valid.



CAUSE
This behavior occurs when you run a Visual Basic for Applications macro that uses the Add method to assign a material resource and includes a variable material consumption rate in the Units value, for example, 2/d or 2/wk.

For example, the following macro generates the error described above: Sub addRes ActiveProject.Tasks(1).Assignments.Add ResourceID:=1, Units:="2/d" End Sub This behavior occurs because the Units argument of the Add method accepts only an integer or decimal value. Other alphanumeric characters are invalid.

Note that if the macro is assigning a work resource rather than a material resource, a percent (%) sign included in the Units value generates the same error.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To work around this problem, assign the material resource first; then modify the units for the assignment to add the variable material consumption rate.

For example, the following macro assigns a material resource and then changes its units to 2 per day:

Sub addRes

'Add resource to task. lAssignUID =  ActiveProject.Tasks(1).Assignments.Add (ResourceID:=1) 'Based on assignment unique ID (UID) returned while adding 'resource, change units for resource. ActiveProject.Tasks(1).Assignments.UniqueID(lAssignUID).Units = "2/d"

End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words: PRJ2007 PRJ2003

Keywords: kbbug kbpending KB242723

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.