conditional formatting help..

F

Francis

Hi,

I'm moving this question from microsoft.public.project to here as was
suggested, any additional help would be greatly appreciated..

Thanks,
Francis
*************************************************************************************
(e-mail address removed)
Jan 31, 3:10 pm show options
Newsgroups: microsoft.public.project
From: (e-mail address removed) - Find messages by this author
Date: 31 Jan 2006 13:10:53 -0800
Local: Tues, Jan 31 2006 3:10 pm
Subject: conditional formatting help..
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

Hi,

I've been wrestling with a problem for a couple of days now. Here's
what I'm trying to do. I would like to italicize and set the color of
the row to purple when a condition on that row is satisfied (verifying
against custom field's data). Most of the code I've come across
requires a for..next loop. I'm trying to avoid this as I don't want
the code to go through every task everytime I change the condition of a
column. I would simply want it to evaluate the new data right on the
spot and change the the formatting of the row. Is this even possible
with MS Project? My Project file consists of smaller Project files
inserted into it. I would get errors about 'method not available in
this situation' if i try to use selecttaskfield or selectrow and I'm
also trying to code this within the ProjectBeforeTaskChange event. Any
help would be greatly appreciated. Thanks.

Francis

Reply



Jan De Messemaeker
Feb 1, 2:55 am show options
Newsgroups: microsoft.public.project
From: "Jan De Messemaeker" <jandemes at prom hyphen ade dot be> - Find
messages by this author
Date: Wed, 1 Feb 2006 09:55:31 +0100
Local: Wed, Feb 1 2006 2:55 am
Subject: Re: conditional formatting help..
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse

Hi,

As a general remark, you better post this kind of questions in the
project.developer group
Still, have you thought of using the
activeselection.tasks(1)
way to identify your task?
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
+32-495-300 620
<[email protected]> schreef in bericht

- Hide quoted text -
- Show quoted text -
I've been wrestling with a problem for a couple of days now. Here's
what I'm trying to do. I would like to italicize and set the color of
the row to purple when a condition on that row is satisfied (verifying
against custom field's data). Most of the code I've come across
requires a for..next loop. I'm trying to avoid this as I don't want
the code to go through every task everytime I change the condition of a
column. I would simply want it to evaluate the new data right on the
spot and change the the formatting of the row. Is this even possible
with MS Project? My Project file consists of smaller Project files
inserted into it. I would get errors about 'method not available in
this situation' if i try to use selecttaskfield or selectrow and I'm
also trying to code this within the ProjectBeforeTaskChange event. Any
help would be greatly appreciated. Thanks.

Reply



Francis
Feb 1, 10:54 am show options
Newsgroups: microsoft.public.project
From: "Francis" <[email protected]> - Find messages by this author
Date: 1 Feb 2006 08:54:53 -0800
Local: Wed, Feb 1 2006 10:54 am
Subject: Re: conditional formatting help..
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

Thanks, I'll move my question there.. I did think of that before, but I
couldn't figure out how to obtain the task ID properly. Since I have
inserted several project files into my main project file, the Task IDs
look like this now.

without expanding the summary lines...

1 Project 1
2
3 Project 2
4
5 Project 3

after expanding the summary lines..

1 Project 1
1 Subproject 1.1
2
3 Subproject 1.2
4
2
3 Project 2
1 Subproject 2.1
2
3 Subproject 2.2
4
4
5 Project 3
1 Subproject 3.1
2
3 Subproject 3.2

so I don't think the Task ID would be beneficial here..
*************************************************************************************
 
J

Jan De Messemaeker

Hi, Hadn't noticed the move, so I replied in teh general group.
I didn't talk about TaskID, what makes ypu thonk I did?
Activeselection.tasks(1) refers to the first or even the only task in the
selection
HTH
 
F

Francis

Right, for some reason I thought it had something to do with the Task
ID. How would I go about obtaining the row number of the current
selection?
 
J

Jan De Messemaeker

The row number?????
Do you actually mean the how-maniest-row that is in the current view taking
into account things like filters or just the ID?

The ID:
activeselection.tasks(1).ID

For the row that would require quite some logic:

TheID=activeselection.tasks(1).ID
selectall
for ctr=1 to activeselection.count
set atask=activeselection.tasks(ctr)
if not atask is nothing then
if atask.id=theid then
therow=ctr
end if
end if
next ctr

You see, Project doesn't care too much about rows so if you want to use them
in your logic you do complicate things
In fact the only reason to have to use rows is to use font instructions.
HTH
 
F

Francis

That's what I was trying to avoid.. ie. looping through the entire
project one task at a time (top to bottom) just so I can capture the
row number.. I've used something similar to your example above in the
open event of the project and it works great there.. but I'm trying to
code as things change on a row (task).. and I don't think it would be
efficient to have to loop through the entire project every time there's
a change on the row and I am only trying to use the rows just so I can
change its font properties as I've mentioned in my original post..
thank you for all your input.. I don't know if I'm explaining myself
clearly.. but what I want to happen is this..

color col3
1 blue row1.3
2 red row2.3

let's say I want to change the font properties of the 2nd row that when
I change the color column from red to blue the entire row's font color
changes to blue and italic.. is there a way to do this without using a
loop?
 
J

Jan De Messemaeker

Hi,

No, it's unfortunately not clear to me.
I thought I understood you but then comes that little matrix with something
like row 1.3
IMHO rows are just row 1, 2, etc. there is no row 1.3

Do you want to color all visible fields of a task of which you know the ID?
HTH
 
F

Francis

the little 'matrix' i created was an example of how the data looks on
the project window.. red, blue are colors that belong to row 1 and 2,
respectively, while 'row 1.3' and 'row 2.3' represents data that
corresponds to row 1 and 2 of column col3..

i want to change the row's formatting when i change a data on that row
without using a loop to obtain the location of the row who's data i
just changed..
 
J

Jan De Messemaeker

Hi,

First, I absolutely ignore why you insist on meking things more difficult.
A for each loop take less than the wink of an eye, so this is pure
masochism.
If the cell is still the active cell just use
selectrow
without any parameter; then use application.font
HTH
 

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