none
Find Field on collapsed tasks RRS feed

  • Question

  • I am trying to use FindField to seelct a particular task in my project. I have found it works fine if the task is visible and not in a collapsed summary but as soon as the summary is collapsed, the field isn't found.

    I am using

    Find Field:="DY_Key Event", test:="contains", Value:="KE.SOP"

    I would ideally not like to change what summaries are collapsed or not as its a rather large project and would take a while to get back to where is was

    Thank you

    Matt

    Tuesday, June 16, 2015 11:07 AM

Answers

  • Matty Boy,

    You're right, the FindField Method only works with foreground processing (i.e. operates on the current visible view). There are a couple alternate approaches you could use.

    Approach A - This allows you to use the code you already have

    1. Capture the current view as a variable (e.g. CurV = ActiveProject.CurrentView)

    2. Expand all tasks and use the macro code I gave you in the other post to gather the data you want

    3. Apply the view the was captured in step 1.

    Approach B - switch to background processing (i.e. operates directly on objects and is independent of the current view)

    Sub KeyEvents2()
    Dim t As Task
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If InStr(1, t.Text1, "KE.SOP") > 0 Then
                Debug.Print t.Start
            End If
        End If
    Next t
    End Sub

    Hope this helps.

    John

    • Marked as answer by Matty Boy Wednesday, June 17, 2015 11:20 AM
    Tuesday, June 16, 2015 3:21 PM

All replies

  • Matty Boy,

    You're right, the FindField Method only works with foreground processing (i.e. operates on the current visible view). There are a couple alternate approaches you could use.

    Approach A - This allows you to use the code you already have

    1. Capture the current view as a variable (e.g. CurV = ActiveProject.CurrentView)

    2. Expand all tasks and use the macro code I gave you in the other post to gather the data you want

    3. Apply the view the was captured in step 1.

    Approach B - switch to background processing (i.e. operates directly on objects and is independent of the current view)

    Sub KeyEvents2()
    Dim t As Task
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If InStr(1, t.Text1, "KE.SOP") > 0 Then
                Debug.Print t.Start
            End If
        End If
    Next t
    End Sub

    Hope this helps.

    John

    • Marked as answer by Matty Boy Wednesday, June 17, 2015 11:20 AM
    Tuesday, June 16, 2015 3:21 PM
  • Thanks John

    I've ended up using the first option

    Wednesday, June 17, 2015 11:20 AM
  • Matty Boy,

    You're welcome and thanks for the feedback. And yes, I've used that same approach in some of my macros.

    John

    Wednesday, June 17, 2015 2:29 PM