C
carjer
Hi. can you help me please?
I created a macro in MS Project 2003. When I execute macro, the MS
project displays the following error:
"Error 91: Object variable or With block variable not set"
When I run debug I see error in "if" but I do not understand what it
means.
Can you please check my code?
Thanks in advance & Happy New Year!
Regards
Private Sub App_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi
As Boolean, Cancel As Boolean)
'MsgBox "" & pj.ProjectSummaryTask.EnterpriseProjectDate3
If (pj.ProjectSummaryTask.EnterpriseProjectCost10 <
pj.ProjectSummaryTask.BaselineCost And
pj.ProjectSummaryTask.EnterpriseProjectCost10 <> 0) Or
(pj.ProjectSummaryTask.EnterpriseProjectDate3 >
pj.ProjectSummaryTask.BaselineStart And
pj.ProjectSummaryTask.EnterpriseProjectDate3 <> "NA") And
(pj.ProjectSummaryTask.EnterpriseProjectDate2 <
pj.ProjectSummaryTask.BaselineFinish Or
pj.ProjectSummaryTask.EnterpriseProjectDate2 <> "NA") Then
MsgBox "Error with save Baseline.", vbCritical
Cancel = True
End If
End Sub
I created a macro in MS Project 2003. When I execute macro, the MS
project displays the following error:
"Error 91: Object variable or With block variable not set"
When I run debug I see error in "if" but I do not understand what it
means.
Can you please check my code?
Thanks in advance & Happy New Year!
Regards
Private Sub App_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi
As Boolean, Cancel As Boolean)
'MsgBox "" & pj.ProjectSummaryTask.EnterpriseProjectDate3
If (pj.ProjectSummaryTask.EnterpriseProjectCost10 <
pj.ProjectSummaryTask.BaselineCost And
pj.ProjectSummaryTask.EnterpriseProjectCost10 <> 0) Or
(pj.ProjectSummaryTask.EnterpriseProjectDate3 >
pj.ProjectSummaryTask.BaselineStart And
pj.ProjectSummaryTask.EnterpriseProjectDate3 <> "NA") And
(pj.ProjectSummaryTask.EnterpriseProjectDate2 <
pj.ProjectSummaryTask.BaselineFinish Or
pj.ProjectSummaryTask.EnterpriseProjectDate2 <> "NA") Then
MsgBox "Error with save Baseline.", vbCritical
Cancel = True
End If
End Sub