|
|
|
date: Fri, 15 Aug 2008 05:35:35 -0700 (PDT),
group: microsoft.public.project.developer
back
Re: Applying a macro to linked projects
In article
,
ggarmon@crh.org wrote:
> I have the following peice of code that changes text color based on
> the task status (thanks Jan). The code works fine except when I
> expand a linked project. The tasks in the linked project do not
> appear in the correct colors. Is there a way to remedy that? The
> code runs when the project is opened.
>
> Private Sub Project_Open(ByVal pj As Project)
> ViewApply "Gantt Chart"
>
> FilterApply "All Tasks"
>
> OutlineShowAllTasks
>
>
> For Each Tsk In ActiveProject.Tasks
> If Not Tsk Is Nothing Then
>
> Select Case Tsk.Status
> Case pjLate
>
> SelectRow Row:=Tsk.ID, RowRelative:=False
> Font Color:=pjRed
>
> Case pjComplete
> SelectRow Row:=Tsk.ID, RowRelative:=False
> Font Color:=pjGreen
>
> Case pjOnSchedule
> SelectRow Row:=Tsk.ID, RowRelative:=False
> Font Color:=pjBlue
>
> Case Else
> SelectRow Row:=Tsk.ID, RowRelative:=False
>
> Font Color:=pjBlack
> End Select
> End If 'Nothing
> Next Tsk
> SendKeys ("^{HOME},^s")
> End Sub
ggarmon,
Well, yes there is a way to do it but remember that inserted projects
are not actually part of the master. If you change font color of
subproject task data at the master level it will NOT change that color
in the actual subproject, the color change will only show at the master
level. There is a way to change the color of the actual subproject task
data but the code would have to open and select the subproject task
itself.
That said, to change the color at the master level, expand the
subproject (OutlineShowTasks expandinsertedprojects:=True), and then set
up an object of all tasks in the current view and loop on those. For
example,
SelectTaskColumn
Set area = ActiveSelection.Tasks
Hope this helps.
John
Project MVP
date: Fri, 15 Aug 2008 07:09:09 -0700
author: John
|
|