Problems with filtered data

P

Peter Rooney

I'm trying to filter my plan to all tasks for any one of 4 sub teams in my
department.
The projects are level 2 tasks and the teams are level 3 tasks - I filter to
show just the team name (say for example, the "Core Tools" team, and when my
filtering is complete, I see something like this:

Plan Header (Level 1)
Project 1 (Level 2)
Core Tools (Level 3)
Project 2 (Level 3)
Core Tools (Level 3)

However, all tasks are displayed with a box with a minus sign against them,
as against a box with a plus sign. If I click the minus sign, it turns into a
plus sign - if I then click the plus sign, the task expands correctly. I've
recorded myself doing this and the resulting code for the above two steps is:

<<Click the box with minus sign>> OutlineHideSubTasks
<<Click the box with plus sign>> OutlineShowSubTasks

If I put these two lines into a macro, click on a task with a box containg a
minus sign, the task is unpacked correctly. If however, I put the code into
the macro below to scan and unpack all tasks for the "Core Tools" team,
nothing happens!

Sub AAExpand()
Dim TestTask As Task
For Each TestTask In ActiveProject.Tasks
If Not TestTask Is Nothing Then
If TestTask.Name = "Core Tools" Then
TestTask.OutlineHideSubTasks
TestTask.OutlineShowSubTasks
End If
End If
Next TestTask
End Sub

All assistance (as usual) gratefully accepted!

Cheers

Pete
 
J

JackD

I think you are probably going about this the wrong way.
Using code to replicate mouse clicks is eventually going to break or have
some sort of problem.

Here is some information that may help you.
In a filtered view, collapsing and expanding an outline level effectively
removes the filtering for any tasks in that branch of the outline.
It seems to me that you are using this because you want the child tasks of a
certain parent that you are filtering for. Instead of doing that, it would
be better to simply mark the child tasks so that they will show in the
filter to begin with. You can do this manually.
For example, you could use a text field (say text1) and for all the child
tasks of Core Tools you would enter "Core Tools" for tasks belonging to the
core tools team and "other stuff" for tasks performed by the other stuff
team etc. etc.. It would be a simple matter to then have your filter
determine if "Text1" equals "Core Tools".

In other words, adding additional data to the tasks so that you can filter
and group them is a better idea than relying on the structure of the file to
do so.
 
P

Peter Rooney

Jan,

Yes you did - I'm sorry if there was any inference that you didn't - I'm
still trying to get your code to work with my plan - almost there, but thanks
for taking the time to look at my query anyway. Just wait until I get my VBA
reference printed out..!

Cheers

Pete
 
P

Peter Rooney

Jack,

Strewth, why didn't I think of this - sometimes the simpler answers are the
best..!

Cheers

Pete
 

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