Consulting

Results 1 to 6 of 6

Thread: Solved: Changing the font of one column field

  1. #1
    VBAX Regular
    Joined
    Dec 2007
    Posts
    12
    Location

    Solved: Changing the font of one column field

    Hello,

    I'm trying a lot but I can't manage it. But how can you change the font in column, if you loop through the active tasks? For example I do want only change the color from the start column:

    [vba]
    Sub SelectTaskRows()
    Dim tskT As Task

    SelectBeginning

    For Each tskT In ActiveProject.Tasks

    'This doesn't work! it jumps to the complete wrong row
    SelectRow Row:=tskT.Start, RowRelative:=False
    Font Color:=pjRed

    'this is more or less from excel. There I can manage it but this doesn't work off course for Ms Project
    'tskT.Start.Interior.ColorIndex = 39
    Next tskT

    End Sub
    [/vba]
    Thanks in advance

    Nico

  2. #2
    VBAX Regular
    Joined
    Dec 2007
    Posts
    12
    Location
    I have solved it by myself:

    [VBA]
    Sub test()
    Dim ts As tasks
    Dim T As Task
    Set ts = ActiveProject.tasks
    For Each T In ts
    If Not T Is Nothing Then
    T.Finish1 = T.Finish
    SelectRow T.UniqueID, RowRelative:=False
    SelectTaskField Row:=T.UniqueID, RowRelative:=False, Column:="start"
    Font Color:=pjBlue, Bold:=True, Italic:=True
    End If
    Next T
    End Sub
    [/VBA]

    Nico

  3. #3
    Hi mate,

    I'm having the same but I can't solve with the way you did.

    i'm working with the "inserted project" as summary task and selecting the ID will only create confusion to ms project (since the id is not unique and order in inserted project).

    any other solutions you can think of?

    Cheers
    R

  4. #4
    VBAX Regular
    Joined
    Dec 2007
    Posts
    12
    Location
    Hi mate,

    I can't follow you. I do not understand what you mean by "inserted project". You have defined projects in you're MS Project file. The first line is called "summary" task line.

    Maybe you can show me the code, or peace of the task list, so that I can see what you mean.

    Nico

  5. #5
    mate... say you have a master project (e.g. master.mpp). In this master project you insert another project as summary task (in my org, we normally call this sumarry task as inserted project).

    Consider the following scenario:

    ---------------------------------
    ID
    Task Name 1 ACP-OPTUS-RENEWAL-RUN-3.4594.mpp 1 Processing
    Victor
    2 ACP-4X4.4611.mpp 1 Processing
    Victor
    3 2EVOLVE-PHONE.4599.mpp 1 Processing
    Victor
    -----------------------------------------

    The above figure shows the ID and task name in task usage view. Sumarry task (inserted project) are ACP-OPTUS-RENEWAL-RUN-3.4594, ACP-4X4.4611.mpp, 2EVOLVE-PHONE.4599.mpp.

    For each inserted project has subtask called "Processing" and "Victor" is the resource name (resource assignment).

    Notice that for each subtask (processing) the ID has been reset to 1 whereas in normal task the ID is always sequentially incremented.

    Take the "ACP-4X4.4611.mpp" task as example. when you execute oTask.ID, it will return "2" but this task actually in 4th row. As a result, I end up selecting "Processing" task under "ACP-OPTUS-RENEWAL-RUN-3.4594" summary task since it is in 2nd row.

    So the VBA code "Selecttaskcell row:= oTask.ID" will never be working.

    Hope you get the clear picture what I mean.

    Cheers
    R

  6. #6
    in addition to my email above, how do you check the "nth" row of the task. Since the oTask.ID and oTask.uniqueID do not return the correct row!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •