Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Compile error: Method or Data member not found

This is a discussion on Compile error: Method or Data member not found within the Excel Questions forums, part of the Question Forums category; This macro is part of the Pertmaster Risk Expert Application: It was not created by me nore modified by me, ...

  1. #1
    New Member
    Join Date
    Jul 2009
    Location
    Los Angeles
    Posts
    10

    Default Compile error: Method or Data member not found

    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"> Option Explicit

    Private m_dtTimeNow As Date

    Private Sub cmdCancel_Click()
    Unload Me
    End Sub

    Private Sub cmdOK_Click()

    Dim nCount As Long
    Dim objTask As Task
    Dim objLink As Link

    'Checks if the txtLag field contains a numeric values
    If Not IsNumeric(txtLag) Then
    MsgBox "The lag duration value is not a valid number."
    txtLag.SetFocus
    Exit Sub
    End If

    'This macro does not convert negative lags
    If Not txtLag.Value >= 0 Then
    MsgBox "The lag duration value cannot be a negative value."
    txtLag.SetFocus
    Exit Sub
    End If

    ' check that the correlation value is in range
    If chkCorrelate Then
    If Not IsNumeric(txtCorr.Value) Then
    MsgBox "The Correlation value is not a valid number"
    txtCorr.SetFocus
    Exit Sub
    End If
    End If

    ' add the links as required
    nCount = 0

    MouseWaitPointer True

    ActivePlan.Windows.AutoRefresh = False
    ActivePlan.AutoTimeAnalyse = False

    m_dtTimeNow = ActivePlan.SummaryInfo.TimeNow

    For Each objTask In ActivePlan.Tasks

    For Each objLink In objTask.Links.Succeeding

    If ShouldAddLag(objTask, objLink) = True Then
    AddLinkTask objTask, objLink
    nCount = nCount + 1
    End If

    Next 'objLink
    Next 'objTask

    ActivePlan.EmptyUndoList
    ActivePlan.AutoTimeAnalyse = False
    ActivePlan.TimeAnalyse
    ActivePlan.Windows.AutoRefresh = True

    MsgBox nCount & " lags converted to tasks"

    SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtLag", txtLag.Value
    SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkSuccRisk", chkSuccRisk.Value
    SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkCorrelate", chkCorrelate.Value
    SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtCorr", txtCorr.Value
    SaveModuleSetting REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkLagsUnderSummary", chkLagsUnderSummary.Value

    Unload Me

    MouseWaitPointer False

    End Sub

    Private Function ShouldAddLag(objTask As Task, objLink As Link) As Boolean
    'Checks if lag should be converted to a task

    ShouldAddLag = False

    Dim objSucTask As Task
    Set objSucTask = objLink.Task

    'is lag greater than or eqaul to the specified value
    If objLink.Lag >= txtLag.Value Then

    'has the successor started
    If objLink.LinkType = eltFinishToStart Or objLink.LinkType = eltStartToStart Then

    If objSucTask.Dates.ActualStart > 0 Then
    Exit Function
    End If

    ElseIf objLink.LinkType = eltFinishToFinish Or objLink.LinkType = eltStartToFinish Then

    If objSucTask.Dates.ActualFinish > 0 Then
    Exit Function
    End If

    End If

    ShouldAddLag = True

    End If

    End Function

    Private Sub AddLinkTask(objTask As Task, objLink As Link)
    'Converts lag into a task and replaces lag with link

    Dim objLinkTask As Task
    Dim objSummaryTask As Task
    Dim objTaskRiskDist As RiskDistribution
    Dim objLagRiskDist As RiskDistribution
    Dim fRatio As Double
    Dim fltRemainingPercent As Double
    Dim nDaysDone As Long
    Dim nRDUR As Long

    Set objLinkTask = ActivePlan.Tasks.Add
    objLinkTask.Name = GetLinkType(objLink) & objTask.Name & ":" & objLink.Task.Name

    objLinkTask.RemainingDuration = objLink.Lag
    objLinkTask.Description = "Lag Task"

    'link the new task in
    If objLink.LinkType = eltFinishToStart Then

    objLinkTask.Links.Preceding.Add objTask.Name, eltFinishToStart
    objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToStart

    Set objTaskRiskDist = objTask.RiskRemainingDuration(eroaReturnOnlyIfExists)

    nRDUR = objTask.RemainingDuration

    ElseIf objLink.LinkType = eltStartToStart Then

    objLinkTask.Links.Preceding.Add objTask.Name, eltStartToStart
    objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToStart

    Set objTaskRiskDist = objLink.Task.RiskRemainingDuration(eroaReturnOnlyIfExists)

    nRDUR = objLink.Task.RemainingDuration

    ElseIf objLink.LinkType = eltFinishToFinish Then

    objLinkTask.Links.Preceding.Add objTask.Name, eltFinishToStart
    objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToFinish

    Set objTaskRiskDist = objTask.RiskRemainingDuration(eroaReturnOnlyIfExists)

    nRDUR = objTask.RemainingDuration

    ElseIf objLink.LinkType = eltStartToFinish Then

    objLinkTask.Links.Preceding.Add objTask.Name, eltStartToStart
    objLinkTask.Links.Succeeding.Add objLink.Task.Name, eltFinishToFinish

    Set objTaskRiskDist = objLink.Task.RiskRemainingDuration(eroaReturnOnlyIfExists)
    nRDUR = objLink.Task.RemainingDuration

    End If

    'set the linktask calendar
    If objLink.LinkType = eltStartToFinish Or objLink.LinkType = eltStartToStart Then
    Set objLinkTask.Calendar = objTask.Calendar
    Else
    Set objLinkTask.Calendar = objLink.Task.Calendar
    End If

    'Set the linkTask Actual start if task has already started
    If objLink.LinkType = eltStartToFinish Or objLink.LinkType = eltStartToStart Then

    If objTask.Dates.ActualStart > 0 Then
    objLinkTask.Dates.ActualStart = objTask.Dates.ActualStart
    End If

    ElseIf objLink.LinkType = eltFinishToStart Or objLink.LinkType = eltFinishToFinish Then

    If objTask.Dates.ActualFinish > 0 Then
    objLinkTask.Dates.ActualStart = objTask.Dates.ActualFinish
    End If

    End If

    If objLinkTask.Dates.ActualStart > 0 Then

    objLinkTask.OriginalDuration = objLink.Lag
    nDaysDone = objTask.GetWorkingTime(objTask.Dates.ActualStart, ActivePlan.SummaryInfo.TimeNow, ewdStartTimeToStartTime)

    If objLink.Lag > nDaysDone Then
    objLinkTask.RemainingDuration = objLink.Lag - nDaysDone
    Else
    objLinkTask.RemainingDuration = 0
    End If

    End If

    If chkSuccRisk.Value = True Then
    ' Set objTaskRiskDist = objLink.Task.RiskRemainingDuration(eroaReturnOnlyIfExists)

    If Not objTaskRiskDist Is Nothing Then

    Set objLagRiskDist = objLinkTask.RiskRemainingDuration(eroaCreateIfNotExist)

    fRatio = objTaskRiskDist.Min / nRDUR
    objLagRiskDist.Min = objLinkTask.RemainingDuration * fRatio

    fRatio = objTaskRiskDist.MostLikely / nRDUR
    objLagRiskDist.MostLikely = objLinkTask.RemainingDuration * fRatio

    fRatio = objTaskRiskDist.Max / nRDUR
    objLagRiskDist.Max = objLinkTask.RemainingDuration * fRatio

    If chkCorrelate.Value = True And txtCorr.Value > "" Then

    Set objLagRiskDist.CorrelationParentRisk = objTaskRiskDist

    objLagRiskDist.CorrelationPercentage = txtCorr.Value

    End If

    End If
    End If

    On Error Resume Next

    'Stores the new tasks representing lags under a summary level
    If chkLagsUnderSummary Then

    Set objSummaryTask = ActivePlan.Tasks("LAGTASKS")

    If objSummaryTask Is Nothing Then
    Set objSummaryTask = ActivePlan.Tasks.Add
    objSummaryTask.Name = "LAGTASKS"
    objSummaryTask.Description = "Lag Tasks"
    objSummaryTask.Style.TextAttributes.BackgroundColor = 255
    End If

    Set objLinkTask.ParentTask = objSummaryTask

    End If

    objLink.Lag = 0

    End Sub

    Private Function GetLinkType(objLink As Link) As String

    'assume FS unless proved otherwise
    GetLinkType = "FS_"

    If objLink.LinkType = eltStartToStart Then
    GetLinkType = "SS_"
    ElseIf objLink.LinkType = eltFinishToFinish Then
    GetLinkType = "FF_"
    ElseIf objLink.LinkType = eltStartToFinish Then
    GetLinkType = "SF_"
    End If

    End Function

    Private Sub chkCorrelate_Click()
    txtCorr.Enabled = chkCorrelate.Value
    End Sub

    Private Sub chkSuccRisk_Click()

    chkCorrelate.Enabled = chkSuccRisk.Value

    If chkCorrelate.Enabled And chkCorrelate.Value Then
    txtCorr.Enabled = True
    Else
    txtCorr.Enabled = False
    End If

    End Sub

    Private Sub txtCorr_Change()

    If txtCorr.Value = "" And chkCorrelate.Value Then
    chkCorrelate.Value = False
    txtCorr.Enabled = False
    End If

    End Sub

    Private Sub UserForm_Initialize()

    chkSuccRisk_Click
    txtLag = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtLag", "20")
    chkSuccRisk.Value = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkSuccRisk", "False")
    chkCorrelate.Value = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkCorrelate", "False")
    txtCorr = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "txtCorr", "100")
    chkLagsUnderSummary.Value = GetModuleSetting(REGISTRY_MODULE_NAME, REIGSTRY_SECTION, "chkLagsUnderSummary", "False")
    chkSuccRisk_Click

    End Sub

  2. #2
    Board Regular
    Join Date
    Jun 2009
    Posts
    321

    Default Re: Compile error: Method or Data member not found

    which line of the code gives you an error? it should highlight the line after you click debug.

  3. #3
    New Member
    Join Date
    Jul 2009
    Location
    Los Angeles
    Posts
    10

    Default Re: Compile error: Method or Data member not found

    ActivePlan.Windows.AutoRefresh = False


    omg thank you so much for helping me with this..

  4. #4
    Board Regular
    Join Date
    Jun 2009
    Posts
    321

    Default Re: Compile error: Method or Data member not found

    Try using "Application.ScreenUpdating = False" instead of that line. Scroll a little way down you will see "ActivePlan.Windows.AutoRefresh = True", replace that with "Application.ScreenUpdating = True" Hope that works for you.

  5. #5
    New Member
    Join Date
    Jul 2009
    Location
    Los Angeles
    Posts
    10

    Default Re: Compile error: Method or Data member not found

    Okay I def. Will do that, that you again and i really hope that works. Don't know why this is happening

  6. #6
    Board Regular
    Join Date
    Jun 2009
    Posts
    321

    Default Re: Compile error: Method or Data member not found

    Make sure you back up all the info. Good Luck

  7. #7
    New Member
    Join Date
    Jul 2009
    Location
    Los Angeles
    Posts
    10

    Default Re: Compile error: Method or Data member not found

    thank you again

  8. #8
    New Member
    Join Date
    Jul 2009
    Location
    Los Angeles
    Posts
    10

    Default Re: Compile error: Method or Data member not found

    yeah i try that it didn't work. What should i do...It tells me the same error message for the codes you sent...thanks again help...Would you know anything else to try

  9. #9
    Board Regular
    Join Date
    Jun 2009
    Posts
    321

    Default Re: Compile error: Method or Data member not found

    What if you just delete those two lines? Take out ActivePlan.Window.AutoRefresh = True/False" lines and try running the macro

  10. #10
    New Member
    Join Date
    Jul 2009
    Location
    Los Angeles
    Posts
    10

    Default Re: Compile error: Method or Data member not found

    Oh Man, I did that and now i am getting the same message for this now?

    m_dtTimeNow = ActivePlan.SummaryInfo.TimeNow

    what do you think is wrong...

Page 1 of 2 12 LastLast

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com