-
Looping through tasks
I am trying to loop through the tasks in two Project 2007 files which contains subprojects. I am using the same vba routine (from Excel) similar to below:
[vba]
For Each tsk in proj.Tasks
blah
blah
blah
Next tsk
For Each subproj in proj.Subprojects
For Each tsk in proj.Tasks
blah
blah
blah
Next tsk
Next subproj
[/vba]
When looping through one one of the files, the first For-Loop grabs all tasks of the master project AND all the tasks of each subproject. When looping through the other file, the first For-Loop only grabs the tasks of the master project, and I need to loop through the tasks of the subprojects seperately using the second set of nested for-loops.
Does anyone know why this would happen?
I can handle either case individually, but don't know beforehand which will happen. I cannot be sure that the master project only contains subprojects and no 'live' tasks of its own. So, I have to loop through the master project's tasks, and I don't want to read the subproject tasks a second time by looping through each subproject if I don't need to.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules