James, this was very helpful. The event handler now works perfectly, but I'm not sure how to deploy it to my Global.MPT.
I developed an event handler which works very well locally. Im trying to add the code to my Global.MPT. When I copy and paste the code into a new Class Module in my Global.MPT, I close out of MS Project. I then launch MS Project and the Event Does NOT fire. My macro security is set to Low. Im not sure what else I have to do&
Do I have to tie the Class Module to a Module? If so, how?
TIA
Heres what the code looks lik (obfuscated for obvious reasons - all underscores are obfuscations):
Public WithEvents ProjApp As Application
Private Sub ProjApp_ProjectBeforeTaskC
Dim ____
Dim ____
__________________
Select Case _____
Case ____"
intResult = MsgBox( "____")
If intResult = ____ Then
Cancel = True
End If
End Select
End Sub
Private Sub ProjApp_ProjectBeforeTaskD
Dim intResult As ______
If _____________=__ Then
intResult = MsgBox("_____________ ")
If intResult = ____ Then
Cancel = True
End If
End If
End Sub
Main Topics
Browse All Topics





by: jbfraserPosted on 2009-11-05 at 07:47:32ID: 25750707
Did you create the event handler for the correct event: either ProjectBeforeTaskChange2 or ProjectBeforeTaskChange:
ht
http://ms
Y
VBA Task Event handlers may be called when you don't expect (as changes cascade,) and also may not be called when you might expect (if the file is embedded in another application, or timephased data is changed.) Test thoroughly, and I wouldn't count on these as a security mechanism. From one of the above links:
Also, I highly recommend Rod Gill's book if you are usiing VBA in Project. VBA Programming for Microsoft Office Project. It should be available through amazon or msprojectexperts.com.
James Fraser