OutlineHide

3

3326ubb

Hi all,
Using MSP'98.
For a relatively large project schedule, I have a simple macro which
gets executed as project opens. This macro is supposed to hide all
sub-tasks of the summary which is 100% complete, but does it only for
first summary task. Next summary tasks which are 100% complete, remain
as it is. What is wrong in macro ?

Sub HIDE()
Dim t as Task
For each t In ActiveProject.Tasks
If t.PercentComplete=100 Then
t.OutlineHideSubTasks
End If
Next t
End Sub

Help please !
 
G

Gérard Ducouret

Hi,

Your macro is working fine for me (I tested it on version 2003)
Are you sure that your summaries are 100% complete ?
If there is only one milestone which is still at 0%, the summary displays
99%.

Gérard Ducouret
 
J

John

3326ubb said:
Hi all,
Using MSP'98.
For a relatively large project schedule, I have a simple macro which
gets executed as project opens. This macro is supposed to hide all
sub-tasks of the summary which is 100% complete, but does it only for
first summary task. Next summary tasks which are 100% complete, remain
as it is. What is wrong in macro ?

Sub HIDE()
Dim t as Task
For each t In ActiveProject.Tasks
If t.PercentComplete=100 Then
t.OutlineHideSubTasks
End If
Next t
End Sub

Help please !

3326ubb,
You're right, for some reason the OutlineHideSubtasks Method doesn't
work as reliably in Project 98 as it does in later versions of Project.
Why, I don't know but I've run in to this type of problem before. The
VBA help file says one thing but it doesn't always work.

Anyway, try the following code. I tested it on your "1" file and it
worked fine. Note, this code will also work with your master file.

Sub HIDE_1()
FilterEdit Name:="ub", taskfilter:=True, create:=True,
overwriteexisting:=True, _
FieldName:="summary", Test:="equals", Value:="yes", _
showinmenu:=False, showsummarytasks:=False
FilterEdit Name:="ub", taskfilter:=True, newFieldName:="% complete", _
Test:="equals", operation:="and", Value:="100"
FilterApply Name:="ub"
SelectAll
OutlineHideSubTasks
FilterApply Name:="all tasks"
End Sub

John
Project MVP
 
3

3326ubb

Thanks for your inputs ..
3326ubb,
You're right, for some reason the OutlineHideSubtasks Method doesn't
work as reliably in Project 98 as it does in later versions o
Project.
Why, I don't know but I've run in to this type of problem before. The
VBA help file says one thing but it doesn't always work.

Anyway, try the following code. I tested it on your "1" file and it
worked fine. Note, this code will also work with your master file.

Sub HIDE_1()
FilterEdit Name:="ub", taskfilter:=True, create:=True,
overwriteexisting:=True, _
FieldName:="summary", Test:="equals", Value:="yes", _
showinmenu:=False, showsummarytasks:=False
FilterEdit Name:="ub", taskfilter:=True, newFieldName:="% complete", _
Test:="equals", operation:="and", Value:="100"
FilterApply Name:="ub"
SelectAll
OutlineHideSubTasks
FilterApply Name:="all tasks"
End Sub

John
Project MV
 

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