Application.ResourceAssignment Method
Project Developer Reference |
Assigns, removes, or replaces the resources of the selected tasks, or changes the number of units for a resource.
Syntax
expression.ResourceAssignment(Resources, Operation, With)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Resources | Optional | String | The names of the resources to be assigned, removed, or replaced in the selected tasks.
Note
Project will not assign a resource if thousands separators or decimal separators are included in the unit values.
|
Note | |||
Project will not assign a resource if thousands separators or decimal separators are included in the unit values. | |||
Operation | Optional | Long | If Operation is omitted, Project assigns the resources to the selected tasks. The default value is pjAssign. Can be one of the following PjResAssignOperation constants:
ConstantDescription
pjAssignAssigns the specified resources to the selected tasks.
pjRemoveRemoves the specified resources from the selected tasks.
pjReplaceThe resources specified with With replace the resources specified with Resources.
pjChangeChanges the resource units for the specified resource. This constant can be used only for a single resource.
|
Constant | Description | ||
pjAssign | Assigns the specified resources to the selected tasks. | ||
pjRemove | Removes the specified resources from the selected tasks. | ||
pjReplace | The resources specified with With replace the resources specified with Resources. | ||
pjChange | Changes the resource units for the specified resource. This constant can be used only for a single resource. | ||
With | Optional | String | When used with the pjReplace constant for Operation, specifies the names of the resources that replace the resources of the selected tasks. |
Return Value
Boolean
Remarks
In Microsoft Office Project 2007, you can use the Resources parameter to specify that a resource assignment is requested or demanded when using the Resource Substitution Wizard. For example, the following macro specifies that the assignment of r1 to the selected task is a requested assignment.
Visual Basic for Applications |
---|
|
Note |
---|
When using the Resources parameter in this way, D specifies "Demand," R specifies "Request," and N specifies "None." In addition, spaces are not allowed between the units value and the Request/Demand value. For example,
Visual Basic for Applications
Visual Basic for Applications
|
Visual Basic for Applications |
|
Visual Basic for Applications |
|
In Office Project 2007, the Resource Substitution Wizard cannot substitute material resources. Therefore, you cannot request or demand a material resource for a particular assignment using the Resources parameter.
Example
The following example prompts the user for the name of a resource, and then assigns that resource to the selected tasks.
Visual Basic for Applications |
---|
|
See Also