1

I need to programmatically make changes to a few tasks. The tasks that need changes have ID numbers in the Text10 field. I would like to avoid using a filter if possible since all of these ID numbers are different. And looping through all the tasks takes way too long since the project file is 10k+ lines. I'm not sure if "Find" is the correct method here.

Question:

Is there a way to find the task using Text10 and assign is to a "Task" object so that I can then manipulate it? The below doesn't work but can hopefully get the point across:

Sub test()

Dim t As Task

Set t = Find("Text10", "equals", "A1044Fh82")
t.SetField pjTaskDuration, 0


End Sub

Thanks!

1 Answer 1

1

The Find method returns True if a matching value is found, and if so, the active selection is moved to the first matching task. So check the result of the Find method and then use the ActiveCell property to get a reference to the task:

If Application.Find("Text10", "equals", "A1044Fh82") Then
    Dim t As Task
    Set t = Application.ActiveCell.Task
    t.Duration = 0
End If
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.