Setting all tasks with a sub task to italic text

P

Peter Rooney

I'm trying to mark off all the tasks with subtasks on my plan as italic, so
when I print out sections of the plan to give to people to update, they won't
provide updates for summary tasks. I noticed that all my summary tasks are
bold, so I was trying to detect the bold property for the task and use it to
change set the italic property, too, but I don't think I've quite got the
hand of the object/properties hierarchy yet. I don't doubt that there's a
smarter way to do this (some test for whether a task has subtasks), but if
someone could make my code work, I'd be very grateful!

Cheers

Pete

Sub AAFonts()
Dim LoopTask As Task
For Each LoopTask In ActiveProject.Tasks
If Not LoopTask Is Nothing Then
If LoopTask.Font.Bold = true Then
MsgBox (LoopTask.Name & " It's Bold!")
LoopTask.Font.Italic (True)
End If
End If
Next LoopTask
End Sub
 
M

Matthew McDermott

Peter,

You don't need VBA for this.

Go to Format | Text Styles.

Select "Summary Tasks" in the "Items to change" list and change the font
style to italic.

Cheers,

Matthew
 
P

Peter Rooney

Matthew,

Ouch! That was a painful lesson to learn after I'd formatted each row
manually.
Still, I'm now lined up for DAYS of fun changing it all round and generally
making a right hash of it..!
Thanks for your help

Pete
 
J

JackD

As for code to do this,
use:

if task.summary then
'whatever
end if

You can use that to change it back!
 
P

Peter Rooney

Very useful tip, Jack - learning more about the object model as the days pass!

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