Forum Discussion

Jasonzhengzx0204's avatar
Jasonzhengzx0204
Copper Contributor
Sep 12, 2026

Regarding the usage of PjAssignmentField in Microsoft Project

Hello, the following code is placed in the ThisAddIn class of a Project VSTO add-in. I want to execute other code when the field Text1 corresponding to the resource assigned under a task changes. The problem I am currently encountering is:
When the Text1 corresponding to the resource assignment under a task changes, the message box "OK" does not pop up. However, in the "Resource Usage" view, when the Text1 of the task assignment under a resource changes, the message box "OK" does pop up.
I hope experts can provide guidance.

    Private Sub ProjectBeforeAssignmentChange(asg As MSProject.Assignment, Field As MSProject.PjAssignmentField,
                NewVal As Object, ByRef Cancel As Boolean ) Handles Application.ProjectBeforeAssignmentChange
        If Field = MSProject.PjAssignmentField.pjAssignmentText1 Then
            MsgBox("OK", vbExclamation)
        End If
    End Sub
No RepliesBe the first to reply