Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Apr 2004
    Location
    Melbourne, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA (Project 2000)

    I had this macro working in Project 1998 but now in 2000 it I keep getting this message and my values are very strange. Could anyone help me? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Sub CalculateValue1()
    For Each t In ActiveProject.Tasks
    If Not t Is Nothing And t.Summary = False Then
    t.Duration = t.Number5 * t.Number4 / 720 / 10
    End If
    Next t
    End Sub

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: VBA (Project 2000)

    In your code, if you have option explicit set, then you need to dimension t.

    Try adding a dimension for t at the beginning of code such as

    Dim t as task

    and then try re-running the code.

    Your code should look something like this:

    <pre>Sub CalculateValue1()
    Dim t as task
    For Each t In ActiveProject.Tasks
    If Not t Is Nothing And t.Summary = False Then
    t.Duration = t.Number5 * t.Number4 / 720 / 10
    End If
    Next t
    End Sub
    </pre>




    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    New Lounger
    Join Date
    Apr 2004
    Location
    Melbourne, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA (Project 2000)

    Thank you Gary that works fine. Could you help me with this: using that macro if I want it to skip calculating a series of task durations that change dependent of what they are grouped with what
    would I use ie: could I use the WBS code? <img src=/S/aussie.gif border=0 alt=aussie width=21 height=22>

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: VBA (Project 2000)

    ... you sort of lost me with your question. You want to skip calculating a series of task durations based on what? If they are grouped, what are they being grouped with, a text field, resource, or other? Or do you mean you want to skip a set of tasks if they fall within a summary task? I just don't understand what you mean.

    I wouldn't recommend grouping on the WBS unless you have some intelligence built into it so you know what length to group by and you are sure it is always being used properly and never regenerated. Thus, I assume you are letting MS Project generate the WBS.

    I will try to help once I better understand what you are doing.
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

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