VBA Express Forum  




Go Back   VBA Express Forum > VBA Code & Other Help > MS Project
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 02-15-2012, 04:44 PM   #1
Puck312

 
Joined: Feb 2012
Posts: 3
Kb Entries: 0
Articles: 0
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 tags courtesy of www.thecodenet.com

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!

Local Time: 08:21 PM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 05:21 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express