Re: any way to highlight every other row in a project.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: any way to highlight every other row in a project.
    ... "John" wrote: ... >>> Chuck, ... >>> I copied the code into my project and got an error messagte ... If it still gives the error, then also add the following references: ...
    (microsoft.public.project)
  • Re: refer to section name?
    ... in this case "References for The second section". ... the macro \cb@biblist. ... The macro \thesection gets redefined to expand to a title-reference ... When switching e.g. from titleref to nameref, ...
    (comp.text.tex)
  • Re: How to send shortcut to desktop after saving in My Docs?
    ... have to go to Tools> References and put a check mark in the box next to ... "Windows Script Host Object Model" to make the macro work. ... I got the following error whenever I try to run the keyboaard shortcut ... Set oShell = New WshShell ...
    (microsoft.public.word.docmanagement)
  • Re: Halt screen startling inexperienced users
    ... >place of the SetValue action in your macro, ... RunCode action (we'll ... >Public Function MakeFormInvisible() ... >> I checked my references in VBA again. ...
    (microsoft.public.access.macros)
  • Re: Cut and paste merge field codes
    ... I had high hopes for this macro, but it doesn't work for me either and I do ... > Hi Dixie, ... > references and add the 'Microsoft Forms 2.0 object' by clicking on it. ... Dim MyData As DataObject, X As Integer ...
    (microsoft.public.word.mailmerge.fields)