Format by Hierarchy: II

E

Ed

Hello I had made a previous post called: Format by Hierarchy, in which I got
a Macro to give a color to the row depending on it's hierarchy. The macro
used is:

Sub Name()
Dim Ctr As Integer
Dim Kleur(3) As Integer
Dim Job As Task

Kleur(1) = pjRed
Kleur(2) = pjNavy
Kleur(3) = pjBlack

FilterApply "All Tasks"
OutlineShowAllTasks

For Ctr = 1 To ActiveProject.Tasks.Count
SelectRow Row:=Ctr, rowrelative:=False

If Not ActiveSelection Is Nothing Then
Font Color:=Kleur(ActiveProject.Tasks(Ctr).OutlineLevel)
End If

Next Ctr
End Sub

I would like to know what should I add to the macro to have Red and Navy in
bold and Black in normal font?

thanks
 
R

Rod Gill

Hi,

The project.developer group is better for VBA questions, but have you tried
recording a macro of you bolding the font of a cell? The recorded code
should give you what you want. From the Object Browser I can see that Font
belongs to the Application Object.
 
J

Jan De Messemaeker

Hi,

Well, I hoped this little starter would inspire you to dive into VBA
yourself, but let's give you one more push:

Sub Name()
Dim Ctr As Integer
Dim Kleur(3) As Integer
dim Dik(3) as Boolean
Dim Job As Task

Kleur(1) = pjRed
Kleur(2) = pjNavy
Kleur(3) = pjBlack
Dik(1)=True
Dik(2)=True
Dik(3)=False


FilterApply "All Tasks"
OutlineShowAllTasks

For Ctr = 1 To ActiveProject.Tasks.Count
SelectRow Row:=Ctr, rowrelative:=False

If Not ActiveSelection Is Nothing Then
Font Color:=Kleur(ActiveProject.Tasks(Ctr).OutlineLevel)
FontBold set:=Dik(ActiveProject.Tasks(Ctr).OutlineLevel)

End If

Next Ctr
End Sub


Hope this helps,
 
E

Ed

Microsoft Office Discusion Groups rock! ;)
Yeah I was experimenting a bit, but yeah this little "push" was helpful
thanks a lot!
 

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