Thanks Rod for the reply...
It works..
I have an another issue:
Backgroud:
I have written the below code in the Before_Save event in the enterprise
global, to perform the updation of %complete field upon saving the active
project plan.
Code is as follows:
Private Sub Project_BeforeSave(ByVal pj As Project)
Dim T As Task
Dim Temp As Long, A As Assignment
Dim aCount As Long
Dim ts As Tasks
If (pj <> Null) And (pj.Name <> "Checked-Out Enterprise Global") Then
If pj.Tasks.Count <> 0 Then
For Temp = 1 To pj.Tasks.Count
Set T = pj.Tasks(Temp)
If T.Assignments.Count <> 0 Then
For aCount = 1 To T.Assignments.Count
Set A = T.Assignments(aCount)
If T.EnterpriseText2 = "Completed" Then
pj.Tasks(Temp).Assignments(aCount).PercentWorkComplete = Val("100")
Else
If T.EnterpriseText2 = "Work In Progress" Then
pj.Tasks(Temp).Assignments(aCount).PercentWorkComplete = Val("50")
Else
pj.Tasks(Temp).Assignments(aCount).PercentWorkComplete = Val("0")
End If
End If
Next aCount
End If
Next Temp
End If
End IF
End Sub
Problem:
When i open project and view code, the code and event is not seem to be
inherited, there is no code on the Project's code window.
When i save the project nothing is happening as there is no code on the
before_save of the project. And when i am trying to close Ms Project the code
seem to get executed and gives the error
'Runtime error '91''
Object variable or with block variable is not set'
i suspect the event is firing not before save but probably on application
close event or similar.
I dont know where i am going wrong
I would be very thankful if you could help me with the above.
Thanks and Regards,
S