Running a macro on a set of collapsed tasks

P

Phyl

Hi all,

I just need some confirmation here: it seems that if I have some tasks
that are collapsed on my schedule, and then run a macro that is
supposed to check all tasks in the schedule, the macro actually
ignores the collapsed tasks.

Is this correct? Is there a way to programmatically check collapsed
tasks?

Thanks for any and all comments and help!
Phyl
 
M

Mark Durrenberger

Depends on the macro, the code below will work on every task (even blank
lines so you'll want to check for "nothing" and possibly "summary" tasks)

use the "Task" collection

dim activity as task
for each activty in activeproject.tasks
do something
next activity

Mark


--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
J

Jan De Messemaeker

Hi Phyl,

That depends on how you try to address "all the tasks"

When you run through them like this

For each anytask in activeproject.tasks

Next anytask


It doesn't matter whether they are collapsed or not - the code even ignores
which view is active, it would even run through all tasks with a resource
view active!

On the other hand,

Selectall
for each anytask in activeselection.tasks

next anytask

will only give you the "visible" tasks

Recommendation:
1. Do not use selection objects when you are not forced (a gun against the
head is an excuse, less is not acceptable) :))
2. If you are forced to do it, use the method outlineshowalltasks befor
running through the selection (not to mention viewapply)

HTH
 
P

Phyl

Thanks to both Jan and Mark! (Or should I say "hartelijk bedankt" to
Jan??)

My code does go through each task in activeproject.tasks (as well as
checking for blank tasks so that they're skipped), so I'll have to see
what else could possibly prevent the macro from "reading" the info in
the collapsed tasks.

One theory down, thousands to go!

Thanks very much,
Phyl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top