ProjectBeforeAssignmentChange Event
Occurs before the user changes the value of an assignment field.
Syntax
Private Sub object**_ProjectBeforeAssignmentChange(ByVal** asg As MSProject.Assignment, ByVal Field As PjAssignmentField, ByVal NewVal As Variant, Cancel As Boolean)
object An object of type Application declared with events in a class module. For more information, see Using events with the Application object.
asg The assignment whose field is being changed.
PjAssignmentField
pjAssignmentActualCost | pjAssignmentHyperlinkHREF |
pjAssignmentActualFinish | pjAssignmentHyperlinkScreenTip |
pjAssignmentActualOvertimeCost | pjAssignmentHyperlinkSubAddress |
pjAssignmentActualOvertimeWork | pjAssignmentIndex |
pjAssignmentActualStart | pjAssignmentLevelingDelay |
pjAssignmentActualWork | pjAssignmentLinkedFields |
pjAssignmentACWP | pjAssignmentNotes |
pjAssignmentAssignmentUnits | pjAssignmentNumber1-20 |
pjAssignmentBaseline1-10Cost | pjAssignmentOverallocated |
pjAssignmentBaseline1-10Finish | pjAssignmentOvertimeCost |
pjAssignmentBaseline1-10Start | pjAssignmentOvertimeWork |
pjAssignmentBaseline1-10Work | pjAssignmentPeak |
pjAssignmentBaselineCost | pjAssignmentPercentWorkComplete |
pjAssignmentBaselineFinish | pjAssignmentProject |
pjAssignmentBaselineStart | pjAssignmentRegularWork |
pjAssignmentBaselineWork | pjAssignmentRemainingCost |
pjAssignmentBCWP | pjAssignmentRemainingOvertimeCost |
pjAssignmentBCWS | pjAssignmentRemainingOvertimeWork |
pjAssignmentConfirmed | pjAssignmentRemainingWork |
pjAssignmentCost | pjAssignmentResourceID |
pjAssignmentCost1-10 | pjAssignmentResourceName |
pjAssignmentCostRateTable | pjAssignmentResourceRequestType |
pjAssignmentCostVariance | pjAssignmentResourceType |
pjAssignmentCV | pjAssignmentResourceUniqueID |
pjAssignmentDate1-10 | pjAssignmentResponsePending |
pjAssignmentDelay | pjAssignmentStart |
pjAssignmentDuration1-10 | pjAssignmentStart1-10 |
pjAssignmentEnterpriseCost1-10 | pjAssignmentStartVariance |
pjAssignmentEnterpriseDate1-30 | pjAssignmentSV |
pjAssignmentEnterpriseDuration1-10 | pjAssignmentTaskID |
pjAssignmentEnterpriseFlag1-20 | pjAssignmentTaskName |
pjAssignmentEnterpriseNumber1-40 | pjAssignmentTaskSummaryName |
pjAssignmentEnterpriseResourceOutlineCode1-30 | pjAssignmentTaskUniqueID |
pjAssignmentEnterpriseText1-40 | pjAssignmentTeamStatusPending |
pjAssignmentFinish | pjAssignmentText1-30 |
pjAssignmentFinish1-10 | pjAssignmentUniqueID |
pjAssignmentFinishVariance | pjAssignmentUpdateNeeded |
pjAssignmentFixedMaterialAssignment | pjAssignmentVAC |
pjAssignmentFlag1-20 | pjAssignmentWork |
pjAssignmentHyperlink | pjAssignmentWorkContour |
pjAssignmentHyperlinkAddress | pjAssignmentWorkVariance |
NewVal The new value for the field specified with Field.
Cancel False when the event occurs. If the event procedure sets this argument to True, the value for the field specified with Field is not changed.
Remarks
Microsoft Office Project 2003 events do not occur when the project is embedded in another document or application.
The ProjectBeforeAssignmentChange event doesn't occur when timescaled data changes, when an entire resource or task row is pasted, when an assignment is changed as the result of a drag-and-drop operation in the Resource Usage view, during resource pool operations, when inserting or removing a subproject, or when changes have been made using a custom form.
Example
This example examines any new resource assignments and cancels them if they are for the specified resource. This example requires a new class module and additional code for it to have an effect. For more information, see Using events with the Application object.
Private Sub App_ProjectBeforeAssignmentChange(ByVal asg As Assignment, ByVal Field As PjAssignmentField, _
ByVal NewVal As Variant, Cancel As Boolean)
If Field = pjAssignmentResourceName And NewVal = "Lisa Jones" Then
MsgBox "Lisa is no longer available for assignment!"
Cancel = True
End If
End Sub
Applies to | Application Object
See Also | ProjectBeforeAssignmentDelete Event | ProjectBeforeAssignmentNew Event | ProjectBeforeResourceChange Event | ProjectBeforeTaskChange Event