Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Format the text in MS Project 2007

Status
Not open for further replies.

Tamrak

MIS
Jan 18, 2001
213
0
0
US
I constructed a template in MS Project Professional. I downloaded the extract (text) file from MS Excel. Let's say, there are two columns, task name and Milestone.

If the milestone = "Yes" on the task name, I would like to have the task name, "bolded". Is it possible to write some types of macros or VBA that way? Additionally, can the fonts be colorized as well?

Please advise. Thank you.
 
Yes. Yes. (With VBA you can do just about anything you want.)
 
Thank you for your reply. Can you provide some codings in order to bold the fonts? Thanks.
 
This will get you started

Dim tsk As Task
For Each tsk In ActiveProject.Tasks
if not tsk is nothing then
SelectRow tsk.UniqueID, RowRelative:=False
SelectTaskField Row:=tsk.UniqueID, _
RowRelative:=False, Column:="Name"
Font Bold:=True
end if
Next

 
I have no successful in converting the code. I would like to email you a screenshot on what I have. Perhaps you will see what I am looking for. You can post the codes in the forum. All I am looking is to have the fonts bolded (Task name) when another column has a "Yes" value.

I do appreciate your time. I cannot load the jpg file due to blocking at my work. Thanks.
 
Minor change. (I have no idea which field you are testing. This code checks %Complete for 100.)

Dim tsk As Task
For Each tsk In ActiveProject.Tasks
If Not tsk Is Nothing Then
If tsk.PercentComplete = 100 Then
SelectTaskField Row:=tsk.ID, _
RowRelative:=False, Column:="Name"
Font Bold:=True, Color:=pjRed
End If
End If
Next
 
To be honest, you would not need a macro to have all Milestones automatically bolded. Click on >Format, >Text Styles, >Milestone Tasks, >Select Bold, then click on OK.

As a side note...I like to change my Critical Tasks to Red.

Hope this helps!

JBlack
 
The criteria that I have is simple. However, this is not Excel and I am stuck.

----------------------------------------------------------

The flat file has a field called, "Type". I associated that field to "Text10". It has some values.

All I want is to have the font and background of that task changed, when the value of that Text10 = Management. (I would like to have the red fonts and light blue background.) I am still stuck on how to get the blue background into this code.


I tried to write the codes with the following:


Public Sub Font_Change()

Dim AllTasks As Tasks
Dim Tsk As Task

Set AllTasks = ActiveProject.Tasks
For Each Tsk In AllTasks
If Not Tsk Is Nothing Then
If Tsk.Text10 = "Management" Then

With ActiveCell
.FontColor = pjRed

End With

End If
End If

Next Tsk

End Sub

*********************

I do appreciate your assistant regarding this matter. Thank you.
 
In message 6 I showed you the Project syntax to set a field.

If tsk.text10 = "Management" Then
SelectTaskField Row:=tsk.ID,RowRelative:=False, Column:="Name"
Font Bold:=True, Color:=pjRed
End If

Background colour is not supported in P2003 and I do not have P2007 installed.

Since you seem fascinated by pretty colours, etc., I suggest you export the project to an Excel file and write your macros there -- Excel is much more useful for pretty pictures; Project is more useful for project management.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top