Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.ProjectBeforeAssignmentChange Event (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Occurs before the user changes the value of an assignment field.

Syntax

expression. ProjectBeforeAssignmentChange( ** asg, ** Field, ** NewVal, ** Cancel )

expression A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
asgRequiredAssignmentThe assignment whose field is being changed.
FieldRequiredPjAssignmentFieldThe field being changed. If more than one field is changed by the user, the event is triggered for each field changed. Can be one of the following PjAssignmentField constants.
NewValRequiredVariantThe new value for the field specified with Field.
CancelRequiredBooleanFalse 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

Project 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. For more information and sample code for creating and testing an event handler, seeUsing Events with Application and Project Objects.

Example

The following example examines 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.

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
© 2018 Microsoft