Re: any way to highlight every other row in a project.
- From: John <mjensen@xxxxxxxxxxxx>
- Date: Fri, 21 Oct 2005 20:51:53 -0700
In article <3F9D7E60-601B-4DDB-A2F4-2F350C6DA85E@xxxxxxxxxxxxx>,
ChuckB <ChuckB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> "John" wrote:
>
> > In article <C0B7E33A-3721-4C26-B84E-0023B7F6A86B@xxxxxxxxxxxxx>,
> > ChuckB <ChuckB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > > Would like to highlight every other row in a project plan; is VBA code
> > > the
> > > ansher
> > > and, if so, can I see an example.
> > >
> > > Thanks,
> > >
> > > Chuck
> >
> > Chuck,
> > Be advised that Project is not like Excel. The field cell background
> > cannot be colored. You can however "highlight" field cells, row data or
> > column data by changing the font characteristics. And yes, that can be
> > done easily with VBA. The following code will change the text of all
> > even ID tasks to blue.
> >
> > Sub Even_row_highlight()
> > i = 1
> > For Each t In ActiveProject.Tasks
> > If Not t Is Nothing Then
> > If t.ID = 2 * i Then
> > SelectRow Row:=t.ID, rowrelative:=False
> > Font Color:=pjBlue
> > i = i + 1
> > End If
> > End If
> > Next t
> >
> > Hope this helps.
> > John
> > Project MVP
> > I copied the code into my project and got an error messagte
> "can't find project or library" when I ran the macro.
>
> Thanks,
>
> Chuck
Chuck,
Well at least you found the right post - that's part "A".
I will assume you know how to set up and run a macro. If not, I'll
provide instructions.
The error message you get sounds like a reference needs to be set for
the object library. From the VB Editor go to Tools/References. As a
minimum, the following references should be checked:
1. Visual Basic for Applications
2. Microsoft Project xx.x Object Library (xx.x is the version of Project
you have installed - 11.0 is for Project 2003)
3. If those aren't checked, find them and check them
4. If it still gives the error, then also add the following references:
a. OLE Automation
b. Microsoft Office xx.x Object Library
5. When all object references are checked, hit "ok"
If the code still fails to execute, tell me exactly how you copied the
code and how you are attempting to run it. It would also be helpful to
know which version of Project you are using although for this simple
macro, it shouldn't matter.
John
Project MVP
.
- Follow-Ups:
- References:
- Prev by Date: Re: Can you apply a calendar to a group in MS Project?
- Next by Date: Re: Can you apply a calendar to a group in MS Project?
- Previous by thread: Re: any way to highlight every other row in a project.
- Next by thread: Re: any way to highlight every other row in a project.
- Index(es):
Relevant Pages
|