The argument value is not valid.
For example, the following macro generates the error described above:
ActiveProject.Tasks(1).Assignments.Add ResourceID:=1, Units:="2/d"
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.
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:
'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"
ID do Artigo: 242723 - Última Revisão: 22 de mar de 2013 - Revisão: 1