Compile error: Method or Data member not found

MyBlackStar

New Member
Joined
Jul 3, 2009
Messages
10
This macro is part of the Pertmaster Risk Expert Application: It was not created by me nore modified by me, it is part of the PertMaster Risk Expert Software:

I am trying to run the Convert Lags To Tasks Macro Ver. 1.3 but i keep getting the following Error Message: Compile error: Method or Data member not found

Would Anyone Be So kind to help me resolve this issue because i am not very apt with VBA scrip and trouble shooting this sort of issues.

Here is the list of the codes for the macro: I have not change any codes from the original pertmaster file.


****** http-equiv="Content-Type" content="text/html; charset=utf-8">****** name="ProgId" content="Word.Document">****** name="Generator" content="Microsoft Word 11">****** name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CJOSERA%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> Option Explicit<o:p></o:p>
<o:p> </o:p>
Private m_dtTimeNow As Date<o:p></o:p>
<o:p> </o:p>
Private Sub cmdCancel_Click()<o:p></o:p>
Unload Me<o:p></o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
Private Sub cmdOK_Click()<o:p></o:p>
<o:p> </o:p>
Dim nCount As Long<o:p></o:p>
Dim objTask As Task<o:p></o:p>
Dim objLink As Link<o:p></o:p>
<o:p></o:p>
'Checks if the txtLag field contains a numeric values<o:p></o:p>
If Not IsNumeric(txtLag) Then<o:p></o:p>
MsgBox "The lag duration value is not a valid number."<o:p></o:p>
txtLag.SetFocus<o:p></o:p>
Exit Sub<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
'This macro does not convert negative lags<o:p></o:p>
If Not txtLag.Value >= 0 Then<o:p></o:p>
MsgBox "The lag duration value cannot be a negative value."<o:p></o:p>
txtLag.SetFocus<o:p></o:p>
Exit Sub<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
' check that the correlation value is in range<o:p></o:p>
If chkCorrelate Then<o:p></o:p>
If Not IsNumeric(txtCorr.Value) Then<o:p></o:p>
MsgBox "The Correlation value is not a valid number"<o:p></o:p>
txtCorr.SetFocus<o:p></o:p>
Exit Sub<o:p></o:p>
End If<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
' add the links as required<o:p></o:p>
nCount = 0<o:p></o:p>
<o:p></o:p>
MouseWaitPointer True<o:p></o:p>
<o:p></o:p>
ActivePlan.Windows.AutoRefresh = False<o:p></o:p>
ActivePlan.AutoTimeAnalyse = False<o:p></o:p>
<o:p></o:p>
m_dtTimeNow = ActivePlan.SummaryInfo.TimeNow<o:p></o:p>
<o:p></o:p>
For Each objTask In ActivePlan.Tasks<o:p></o:p>
<o:p></o:p>
For Each objLink In objTask.Links.Succeeding<o:p></o:p>
<o:p></o:p>
If ShouldAddLag(objTask, objLink) = True Then<o:p></o:p>
AddLinkTask objTask, objLink<o:p></o:p>
nCount = nCount + 1<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
Next 'objLink<o:p></o:p>
Next 'objTask<o:p></o:p>
<o:p></o:p>
ActivePlan.EmptyUndoList<o:p></o:p>
ActivePlan.AutoTimeAnalyse = False<o:p></o:p>
ActivePlan.TimeAnalyse<o:p></o:p>
ActivePlan.Windows.AutoRefresh = True<o:p></o:p>
<o:p></o:p>
MsgBox nCount & " lags converted to tasks"<o:p></o:p>
<o:p></o:p>
SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtLag", txtLag.Value<o:p></o:p>
SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkSuccRisk", chkSuccRisk.Value<o:p></o:p>
SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkCorrelate", chkCorrelate.Value<o:p></o:p>
SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtCorr", txtCorr.Value<o:p></o:p>
SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkLagsUnderSummary", chkLagsUnderSummary.Value<o:p></o:p>
<o:p></o:p>
Unload Me<o:p></o:p>
<o:p></o:p>
MouseWaitPointer False<o:p></o:p>
<o:p></o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
Private Function ShouldAddLag(objTask As Task, objLink As Link) As Boolean<o:p></o:p>
'Checks if lag should be converted to a task<o:p></o:p>
<o:p> </o:p>
ShouldAddLag = False<o:p></o:p>
<o:p> </o:p>
Dim objSucTask As Task<o:p></o:p>
Set objSucTask = objLink.Task<o:p></o:p>
<o:p> </o:p>
'is lag greater than or eqaul to the specified value<o:p></o:p>
If objLink.Lag >= txtLag.Value Then<o:p></o:p>
<o:p> </o:p>
'has the successor started<o:p></o:p>
If objLink.LinkType = eltFinishToStart Or objLink.LinkType = eltStartToStart Then<o:p></o:p>
<o:p></o:p>
If objSucTask.Dates.ActualStart > 0 Then<o:p></o:p>
Exit Function<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
ElseIf objLink.LinkType = eltFinishToFinish Or objLink.LinkType = eltStartToFinish Then<o:p></o:p>
<o:p></o:p>
If objSucTask.Dates.ActualFinish > 0 Then<o:p></o:p>
Exit Function<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p> </o:p>
ShouldAddLag = True<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p> </o:p>
End Function<o:p></o:p>
<o:p> </o:p>
Private Sub AddLinkTask(objTask As Task, objLink As Link)<o:p></o:p>
'Converts lag into a task and replaces lag with link<o:p></o:p>
<o:p></o:p>
Dim objLinkTask As Task<o:p></o:p>
Dim objSummaryTask As Task<o:p></o:p>
Dim objTaskRiskDist As RiskDistribution<o:p></o:p>
Dim objLagRiskDist As RiskDistribution<o:p></o:p>
Dim fRatio As Double<o:p></o:p>
Dim fltRemainingPercent As Double<o:p></o:p>
Dim nDaysDone As Long<o:p></o:p>
Dim nRDUR As Long<o:p></o:p>
<o:p></o:p>
Set objLinkTask = ActivePlan.Tasks.Add<o:p></o:p>
objLinkTask.Name = GetLinkType(objLink) & objTask.Name & ":" & objLink.Task.Name<o:p></o:p>
<o:p></o:p>
objLinkTask.RemainingDuration = objLink.Lag<o:p></o:p>
objLinkTask.Description = "Lag Task"<o:p></o:p>
<o:p></o:p>
'link the new task in<o:p></o:p>
If objLink.LinkType = eltFinishToStart Then<o:p></o:p>
<o:p></o:p>
objLinkTask.Links.Preceding.Add objTask.Name, eltFinishToStart<o:p></o:p>
objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToStart<o:p></o:p>
<o:p></o:p>
Set objTaskRiskDist = objTask.RiskRemainingDuration(eroaReturnOnlyIfExists)<o:p></o:p>
<o:p></o:p>
nRDUR = objTask.RemainingDuration<o:p></o:p>
<o:p></o:p>
ElseIf objLink.LinkType = eltStartToStart Then<o:p></o:p>
<o:p></o:p>
objLinkTask.Links.Preceding.Add objTask.Name, eltStartToStart<o:p></o:p>
objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToStart<o:p></o:p>
<o:p></o:p>
Set objTaskRiskDist = objLink.Task.RiskRemainingDuration(eroaReturnOnlyIfExists)<o:p></o:p>
<o:p></o:p>
nRDUR = objLink.Task.RemainingDuration<o:p></o:p>
<o:p></o:p>
ElseIf objLink.LinkType = eltFinishToFinish Then<o:p></o:p>
<o:p></o:p>
objLinkTask.Links.Preceding.Add objTask.Name, eltFinishToStart<o:p></o:p>
objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToFinish<o:p></o:p>
<o:p></o:p>
Set objTaskRiskDist = objTask.RiskRemainingDuration(eroaReturnOnlyIfExists)<o:p></o:p>
<o:p></o:p>
nRDUR = objTask.RemainingDuration<o:p></o:p>
<o:p></o:p>
ElseIf objLink.LinkType = eltStartToFinish Then<o:p></o:p>
<o:p></o:p>
objLinkTask.Links.Preceding.Add objTask.Name, eltStartToStart<o:p></o:p>
objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToFinish<o:p></o:p>
<o:p></o:p>
Set objTaskRiskDist = objLink.Task.RiskRemainingDuration(eroaReturnOnlyIfExists)<o:p></o:p>
nRDUR = objLink.Task.RemainingDuration<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
'set the linktask calendar<o:p></o:p>
If objLink.LinkType = eltStartToFinish Or objLink.LinkType = eltStartToStart Then<o:p></o:p>
Set objLinkTask.Calendar = objTask.Calendar<o:p></o:p>
Else<o:p></o:p>
Set objLinkTask.Calendar = objLink.Task.Calendar<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
'Set the linkTask Actual start if task has already started<o:p></o:p>
If objLink.LinkType = eltStartToFinish Or objLink.LinkType = eltStartToStart Then<o:p></o:p>
<o:p></o:p>
If objTask.Dates.ActualStart > 0 Then<o:p></o:p>
objLinkTask.Dates.ActualStart = objTask.Dates.ActualStart<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
ElseIf objLink.LinkType = eltFinishToStart Or objLink.LinkType = eltFinishToFinish Then<o:p></o:p>
<o:p></o:p>
If objTask.Dates.ActualFinish > 0 Then<o:p></o:p>
objLinkTask.Dates.ActualStart = objTask.Dates.ActualFinish<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
If objLinkTask.Dates.ActualStart > 0 Then<o:p></o:p>
<o:p></o:p>
objLinkTask.OriginalDuration = objLink.Lag<o:p></o:p>
nDaysDone = objTask.GetWorkingTime(objTask.Dates.ActualStart, ActivePlan.SummaryInfo.TimeNow, ewdStartTimeToStartTime)<o:p></o:p>
<o:p></o:p>
If objLink.Lag > nDaysDone Then<o:p></o:p>
objLinkTask.RemainingDuration = objLink.Lag - nDaysDone<o:p></o:p>
Else<o:p></o:p>
objLinkTask.RemainingDuration = 0<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
If chkSuccRisk.Value = True Then<o:p></o:p>
' Set objTaskRiskDist = objLink.Task.RiskRemainingDuration(eroaReturnOnlyIfExists)<o:p></o:p>
<o:p></o:p>
If Not objTaskRiskDist Is Nothing Then<o:p></o:p>
<o:p></o:p>
Set objLagRiskDist = objLinkTask.RiskRemainingDuration(eroaCreateIfNotExist)<o:p></o:p>
<o:p></o:p>
fRatio = objTaskRiskDist.Min / nRDUR<o:p></o:p>
objLagRiskDist.Min = objLinkTask.RemainingDuration * fRatio<o:p></o:p>
<o:p></o:p>
fRatio = objTaskRiskDist.MostLikely / nRDUR<o:p></o:p>
objLagRiskDist.MostLikely = objLinkTask.RemainingDuration * fRatio<o:p></o:p>
<o:p></o:p>
fRatio = objTaskRiskDist.Max / nRDUR<o:p></o:p>
objLagRiskDist.Max = objLinkTask.RemainingDuration * fRatio<o:p></o:p>
<o:p></o:p>
If chkCorrelate.Value = True And txtCorr.Value > "" Then<o:p></o:p>
<o:p></o:p>
Set objLagRiskDist.CorrelationParentRisk = objTaskRiskDist<o:p></o:p>
<o:p></o:p>
objLagRiskDist.CorrelationPercentage = txtCorr.Value<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
End If<o:p></o:p>
<o:p> </o:p>
On Error Resume Next<o:p></o:p>
<o:p> </o:p>
'Stores the new tasks representing lags under a summary level<o:p></o:p>
If chkLagsUnderSummary Then<o:p></o:p>
<o:p></o:p>
Set objSummaryTask = ActivePlan.Tasks("LAGTASKS")<o:p></o:p>
<o:p></o:p>
If objSummaryTask Is Nothing Then<o:p></o:p>
Set objSummaryTask = ActivePlan.Tasks.Add<o:p></o:p>
objSummaryTask.Name = "LAGTASKS"<o:p></o:p>
objSummaryTask.Description = "Lag Tasks"<o:p></o:p>
objSummaryTask.Style.TextAttributes.BackgroundColor = 255<o:p></o:p>
End If<o:p></o:p>
<o:p> </o:p>
Set objLinkTask.ParentTask = objSummaryTask<o:p></o:p>
<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
objLink.Lag = 0<o:p></o:p>
<o:p> </o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
Private Function GetLinkType(objLink As Link) As String<o:p></o:p>
<o:p> </o:p>
'assume FS unless proved otherwise<o:p></o:p>
GetLinkType = "FS_"<o:p></o:p>
<o:p></o:p>
If objLink.LinkType = eltStartToStart Then<o:p></o:p>
GetLinkType = "SS_"<o:p></o:p>
ElseIf objLink.LinkType = eltFinishToFinish Then<o:p></o:p>
GetLinkType = "FF_"<o:p></o:p>
ElseIf objLink.LinkType = eltStartToFinish Then<o:p></o:p>
GetLinkType = "SF_"<o:p></o:p>
End If<o:p></o:p>
<o:p> </o:p>
End Function<o:p></o:p>
<o:p> </o:p>
Private Sub chkCorrelate_Click()<o:p></o:p>
txtCorr.Enabled = chkCorrelate.Value<o:p></o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
Private Sub chkSuccRisk_Click()<o:p></o:p>
<o:p></o:p>
chkCorrelate.Enabled = chkSuccRisk.Value<o:p></o:p>
<o:p></o:p>
If chkCorrelate.Enabled And chkCorrelate.Value Then<o:p></o:p>
txtCorr.Enabled = True<o:p></o:p>
Else<o:p></o:p>
txtCorr.Enabled = False<o:p></o:p>
End If<o:p></o:p>
<o:p> </o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
Private Sub txtCorr_Change()<o:p></o:p>
<o:p> </o:p>
If txtCorr.Value = "" And chkCorrelate.Value Then<o:p></o:p>
chkCorrelate.Value = False<o:p></o:p>
txtCorr.Enabled = False<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
Private Sub UserForm_Initialize()<o:p></o:p>
<o:p> </o:p>
chkSuccRisk_Click<o:p></o:p>
txtLag = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtLag", "20")<o:p></o:p>
chkSuccRisk.Value = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkSuccRisk", "False")<o:p></o:p>
chkCorrelate.Value = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkCorrelate", "False")<o:p></o:p>
txtCorr = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtCorr", "100")<o:p></o:p>
chkLagsUnderSummary.Value = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkLagsUnderSummary", "False")<o:p></o:p>
chkSuccRisk_Click<o:p></o:p>
<o:p> </o:p>
End Sub
 
Well, I don't what the PertMaster Risk Expert Software is, but from the Error it sounds like "ActivePlan" is not recognized as object and all the methods/properties (Window.AutoRefresh, SummaryInfo) are not a part of "ActivePlan". That is my guess. Unfortunatelly without knowing about coding at PertMaster, I can't help much more.
I just googled it online but didn't find much on it.
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Where is this code actually being used/executed from?
 
Upvote 0
Yeah, I know man. It's hard. Pertmaster is Risk Management Software for Risk analysis and creating risk scenarios. It's bit complicated and costly too. So, i don't understand why i am having such issues with this because when you pay 8000 USD for a license Key and you can finish work, is freaking annoying...


well, thank you again for all the help you have provided. I also posted this message on the Primavera Pertmater Forum, so i am waiting for those basters to help but they never reply to my questions....

that's why i was trying this forum, i know it gets lots of good information here and excellent ppl.

Thanks again and have a wonderful 4th of july....


jose
 
Upvote 0
It is Within the Primavera Pertmaster Application...This Macros are extra tools or functions to help the risk manager and are must likely developing tool that probably will be added to the next future software version...if they are popular enough....I can send you the actual macro the is provided with the software if you would like to look at it more closely...
 
Upvote 0
jose

Do you realise that Oracle acquired Primavera, who I believe created this tool, last October?

There still seems to be a Pertmaster 'knowledge base', here's a link to one article.
 
Upvote 0
Hey, i read that workaround solution and it is very helpful. thank you...Do you know Pertmaster?

Sorry about not tagging the codes correctly...
 
Upvote 0
Lol, I found that site as well, but was reading a different section of it which provided fixes and they didn't say anything about the current issue. So I didn't bother posting it :)

Good luck on your use of it.

Max
 
Upvote 0
yeah, i read to but those solutions are for the older version of Pertmaster 7.8 the current version i am using is the lastest 8.5...Which i think they already resolved the issue with excel's VBA issue, I would atleast hope they did since they have known about the issue since ver. 7.8....The problem could be that this macro is from the older version since it was never released for the current version but it suppose to be pretty good. I am doing it by hand now and it takes a while, oh yeah...how exiting...
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top