How can I display completed tasks in smaller font?

S

SigR

I am using Project 2002 and would like to change a tasks' font whenever it is
completed.

I found "Task Styles" but "Completed" is not an option.

I have created a "Marked" column with the desired formatting. How can I
force the Mark value to "Yes" when I click the <100%> button?

Or is there another solution?

Thanks in advance
SigR
 
J

Jim Aksel

Create and run this Macro:

Public Sub toggleMarked()
Dim tsk As Task
For Each tsk In ActiveProject.Tasks
If Not tsk Is Nothing Then
If tsk.PercentComplete = 100 Then
tsk.Marked = True
End If
End If
Next tsk
End Sub
--
If this post was helpful, please consider rating it.

Jim
It''s software; it''s not allowed to win.

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
S

SigR

Thanks, Jim, but I'm afraid right now the software IS winning.

I want to somehow trigger off of the event of clicking on the "100%
complete" button on my tracking toolbar. So that one click both sets the
task to complete and at the same time sets the smaller font.

SigR
 
J

John

SigR said:
I am using Project 2002 and would like to change a tasks' font whenever it is
completed.

I found "Task Styles" but "Completed" is not an option.

I have created a "Marked" column with the desired formatting. How can I
force the Mark value to "Yes" when I click the <100%> button?

Or is there another solution?

Thanks in advance
SigR

SigR,
It can be done but it will take VBA to do it. Well, actually there is
another way but it requires using a formula and paste links so I
wouldn't recommend it.

John
Project MVP
 
J

Jim Aksel

Let me think about it, we need to find an "After Update" or "Before Update"
method and then modify that to trigger the macro. It can be done, we just
need to look for it in the VBA
--
If this post was helpful, please consider rating it.

Jim
It''s software; it''s not allowed to win.

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
J

Jim Aksel

Try this:

Private Sub Project_Change(ByVal pj As Project)
dim tsk as task
For Each tsk In ActiveProject.Tasks
If Not tsk Is Nothing Then
If tsk.PercentComplete = 100 Then
tsk.Marked = True
End If
End If
Next tsk

End Sub

I believe this will execute every time anything changes.
It could make for a long day if the file is large.
This will run after every change.
--
If this post was helpful, please consider rating it.

Jim
It''s software; it''s not allowed to win.

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
S

SigR

Thanks an awful lot, Jim, that was what I needed!
I modified it as follows to allow a task to go from completed to not
completed and to restrict the activity to the current task.l

Private Sub Project_Change(ByVal pj As Project)
If Not ActiveCell.Task Is Nothing Then
If ActiveCell.Task.PercentComplete = 100 Then
ActiveCell.Task.Marked = True
Else
ActiveCell.Task.Marked = False
End If
End If
End Sub

Again, thank you. There ought to be a simpler way, but this works!
SigR
 
S

SigR

Just in case anyone is following this, this post is to show the error of my
ways.

My solution works, as far as it goes, but it does not go far enough.
When all the sub-tasks of a given task are completed, the parent is
automatically marked 100%, but the font size is not reduced!

Jim Aksel's solution does not have this problem.
I'll keep you posted.

Moderator question: I am over the border now and should I be in the
Developers forum?

SigR
 
S

SigR

Final working solution:

Private Sub Project_Change(ByVal pj As Project)

' COMPLETED TASKS DISPLAY SMALL FONT

' Sets the font of a task to smaller size when it is marked 100%
' Note: this does not set the font of any already completed task
' Works by setting "Mark" property to true when
' a task is set to 100%
' Assumes Format Text Styles for Marked tasks is set to 6 points

Dim OutL As Integer 'Outline level
Dim LoopCntr As Integer 'Loop counter
Dim Tsk As Task

If Not ActiveCell.Task Is Nothing Then
Set Tsk = ActiveCell.Task
If Tsk.PercentComplete = 100 Then
Tsk.Marked = True
Else
Tsk.Marked = False ' Used if a task reset to <100%
End If

' Set summary tasks if all their subordinate tasks are complete
If Tsk.OutlineLevel <> 1 Then
OutL = Tsk.OutlineLevel - 1
For LoopCntr = OutL To 1 Step -1
Set Tsk = Tsk.OutlineParent
If Tsk.PercentComplete = 100 Then
Tsk.Marked = True
Else
Tsk.Marked = False
End If
Next LoopCntr
End If
End If
End Sub

Just in case anyone is following this, this post is to show the error of my

My solution works, as far as it goes, but it does not go far enough.
When all the sub-tasks of a given task are completed, the parent is
automatically marked 100%, but the font size is not reduced!
Jim Aksel's solution does not have this problem.
I'll keep you posted.
Moderator question: I am over the border now and should I be in the
Developers forum?

"SigR" wrote:
 
R

Raghu

I am a bit new to using macros. I copied and pasted the macro below into MPP
and it gives me compiler error saying "no end sub" and later in another try i
got an error saying invalid sub ..... can some one please tell me what i need
to do to get this macro running. thanks
 

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