I just tested this scenario using the ProjectBeforeTaskChange2 event. It works like a charm.
(I am assuming that you have created a class that allows you to enable the capture of ProjectBeforeTaskChange2 events.)
Here’s the code I used:
If Field = pjTaskOutlineLevel And ActiveCell.Task.OutlineLevel < NewVal Then If ActiveProject.tasks(ActiveCell.Task.ID – 1).ResourceNames <> "" Then Message "The preceeding Task has resources assigned. This change in Outline Level is not allowed." Info.Cancel = True End IfEnd If
Changing the outline level does trigger a task change event.