Shannon Mollenhauer
asked on
MS Project 2010 pastelink fields - finding tasks with VBA
We have used the copy and Paste Special - Text Link feature to create hammock tasks in MS Project 2010. I know they show a small gray triangle in the lower right corner of a start or finish date field which is linked to another task's date field. But, we need to document which tasks have that link in either start or finish or both. I'm sure this requires some VBA examination of the contents of a date field and then either adding that link reference information to the task's notes, a custom text field, or another list to be pasted into a Word or Excel document for further viewing.
I have little VBA experience, so I'm using my paid resource to see if someone here can show what that kind of loop through all the tasks would look like. I'm just looking for links in start and finish. If we can store the UID of the linked task in a number field or text field, I would be fine with that. Probably one field for a start link and one for a finish link. And, whether the link is to the task's start or finish field, now that I think about it. Those would go in a text field.
Thanks for the guidance.
I have little VBA experience, so I'm using my paid resource to see if someone here can show what that kind of loop through all the tasks would look like. I'm just looking for links in start and finish. If we can store the UID of the linked task in a number field or text field, I would be fine with that. Probably one field for a start link and one for a finish link. And, whether the link is to the task's start or finish field, now that I think about it. Those would go in a text field.
Thanks for the guidance.
ASKER
Thanks for the help. I'll use your structure for the basic loop and see if I can get an accumulator in there to display the count and task IDs for linked tasks. Maybe I can post something in the MS community or some MSP SIG forum about this. The data indicating where the link goes has to be stored somewhere in order for the program itself to know what to link, so hopefully it's accessible through code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
as far as I know you can only find the tasks with linked fields by running through all tasks and checking for the LinkedFields property. Unfortunately there is no way to see WHERE the link goes to.
A simple Version of the code would be:
---
Sub FindLinkedTasks()
Dim oTask As Task
For Each oTask In ActiveProject.Tasks
If Not oTask Is Nothing Then
If oTask.LinkedFields Then
'need some code here to count or display the tasks that have linked fields
End If
End If
Next
End Sub
---
Hope this helps
Thomas