Timescale Data / Enterprise Field

R

RevKev

Hello All..
I am trying to export a custom view to excel. I have successfully exported
all left and right pane data, however, it is not grouped properley.

The view is grouped by an EnterpriseOutlineCode and I am not sure how I can
loop through the grouping versus how I am doing it now which is looping
through the timescalevalues.

Any help is appreciated...
 
J

John

RevKev said:
Hello All..
I am trying to export a custom view to excel. I have successfully exported
all left and right pane data, however, it is not grouped properley.

The view is grouped by an EnterpriseOutlineCode and I am not sure how I can
loop through the grouping versus how I am doing it now which is looping
through the timescalevalues.

Any help is appreciated...

RevKev,
It sounds like you are trying to replicate a grouped view from Project
in Excel. The best way to do that is to use foreground processing to
gather the current view data in Project (I did basically the same thing
in a macro I wrote). Here are the pseudo code steps:
1. Set the grouped view in Project
2. Select all tasks (I normally used SelectTaskColumn - it doesn't
matter which column happens to be active)
3. Use a For Each t in ActiveSelection.Tasks loop structure

Note, this process will not read the group summary lines. As far as I
know, those are not available through VBA. I use a little subroutine to
create arrays for grouping the data while the code is reading the
Project data. The arrays are then used to create the group summary lines
in Excel.

Hope this helps.
John
Project MVP
 
R

RevKev

John,
Thanks for your reply.
Here is what I have so far. I can actually access the group itself, but I
cannot dig deeper into the group... for example, the Group is: ABC, however,
the group is broken down further into: ABC.XYZ and ABC.TUV. I cannot get to
the XYZ and TUV which is the EnterpriseOutlineCode. I suppose I could set a
flag to write out each outline code and then continue within the group, but
is there a better way?

Here is my code:

Sub OutlineCode()
Dim Proj As Project
Dim t As Task
Dim r As Resource
Dim g As Group
Dim Asgn As Assignment

Dim tsv As TimeScaleValue
Dim tsvs As TimeScaleValues

Dim i As Group
Dim c As Integer
'Dim x As something here

c = ActiveProject.Resources.count
For Each i In ActiveProject.ResourceGroups
If i = "ABC" Then
c = ActiveProject.Resources.count
For Each r In ActiveProject.Resources
If Not ActiveProject.Resources(r) Is Nothing Then
If ActiveProject.Resources(r).Cost > 0 Then
'For Each x In r.EnterpriseOutlineCode6 - trying to go further here
Debug.Print r.Name
Debug.Print r.EnterpriseOutlineCode6 'this is the correct OC for this
group
'Next x
End If
End If
Next r
End If
Next i
End Sub
 
J

John

RevKev said:
John,
Thanks for your reply.
Here is what I have so far. I can actually access the group itself, but I
cannot dig deeper into the group... for example, the Group is: ABC, however,
the group is broken down further into: ABC.XYZ and ABC.TUV. I cannot get to
the XYZ and TUV which is the EnterpriseOutlineCode. I suppose I could set a
flag to write out each outline code and then continue within the group, but
is there a better way?

Here is my code:

Sub OutlineCode()
Dim Proj As Project
Dim t As Task
Dim r As Resource
Dim g As Group
Dim Asgn As Assignment

Dim tsv As TimeScaleValue
Dim tsvs As TimeScaleValues

Dim i As Group
Dim c As Integer
'Dim x As something here

c = ActiveProject.Resources.count
For Each i In ActiveProject.ResourceGroups
If i = "ABC" Then
c = ActiveProject.Resources.count
For Each r In ActiveProject.Resources
If Not ActiveProject.Resources(r) Is Nothing Then
If ActiveProject.Resources(r).Cost > 0 Then
'For Each x In r.EnterpriseOutlineCode6 - trying to go further here
Debug.Print r.Name
Debug.Print r.EnterpriseOutlineCode6 'this is the correct OC for this
group
'Next x
End If
End If
Next r
End If
Next i
End Sub

RevKev,
Off hand, I don't know. I'd have to play with it myself to come up with
a specific solution in your case. Unless someone else checks in with a
response, I'd go with your "I suppose I could ..." approach.

John
Project MVP
 

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