S
stinkrod35
I am working on a script to report time phased tasks grouped by a
custom outline code in Excel. I have grouped them in a Task Usage view
which leads to a grouped summation for each task. I want time scaled
values of custom groupings. If there is a better way, I could not find
it. This problem is still annoying either way...
First I go to my custom Task Usage View and export all of the Task
names and outline codes in the view. No Problem there:
For Each T In ActiveSelection.Tasks
xlApp.ActiveSheet.Cells(i, cWBSCode).Activate
xlApp.ActiveCell.Value = T.Text1
Next, I go through the group summations in the left pane to get a few
values like cost, actual cost, etc. Again no problem:
For i = 1 To NumTasks
xlApp.ActiveSheet.Cells(i + 1, cCost).Activate
SelectTaskCell Row:=(i * 2 - 1), Column:="Cost",
RowRelative:=False
xlApp.ActiveCell.Value = ActiveCell.Text
When I try to copy the time phased data from the right side, I run
into problems. I recorded a macro of selecting a cell on the right
side, and pasting it to Excel:
SelectTimescaleRange Row:=3, StartTime:="1/1/06", Width:=1, Height:=1
EditCopy
I pasted that into Excel and it worked fine. When I run it as a Maco,
it pastes the last selected cell on the left side:
SelectTimescaleRange Row:=(i * 6 - 4), StartTime:=FY07, Width:=1,
Height:=1
EditCopy
xlApp.ActiveSheet.Paste
The (i*6-4) part is because I have three rows of time phase data for
every row (cost, baseline, actual). That much works because I see the
right cells get highlighted.
Is there any good reason why this works when I do it by hand, but not
when I script it, using the exact recorded macro?
Also, when I clicked between the left and right sides of the usage
view, "NextPane" was recorded. According the help documentation, that
only has to do with the top and bottom panes, so I don't know why I
was seeing that. I tried it with "Next Pane" and without, and had the
same results.
I think the root of my problem is that I can't see what the
SelectTimeScaleRange method does. According to the documentation it
selects timescale data cells in the usage view. This doesn't seem to
change the ActiveSelection, and I can't find any effect anywhere in
the Application object when I do this. Do I need to make this
selection the ActiveSelection or add it to the ActiveSelection (both
of which also sound wrong)?
Running Standard 2003 SP 2 BTW. Any thoughts? I am stumped.
custom outline code in Excel. I have grouped them in a Task Usage view
which leads to a grouped summation for each task. I want time scaled
values of custom groupings. If there is a better way, I could not find
it. This problem is still annoying either way...
First I go to my custom Task Usage View and export all of the Task
names and outline codes in the view. No Problem there:
For Each T In ActiveSelection.Tasks
xlApp.ActiveSheet.Cells(i, cWBSCode).Activate
xlApp.ActiveCell.Value = T.Text1
Next, I go through the group summations in the left pane to get a few
values like cost, actual cost, etc. Again no problem:
For i = 1 To NumTasks
xlApp.ActiveSheet.Cells(i + 1, cCost).Activate
SelectTaskCell Row:=(i * 2 - 1), Column:="Cost",
RowRelative:=False
xlApp.ActiveCell.Value = ActiveCell.Text
When I try to copy the time phased data from the right side, I run
into problems. I recorded a macro of selecting a cell on the right
side, and pasting it to Excel:
SelectTimescaleRange Row:=3, StartTime:="1/1/06", Width:=1, Height:=1
EditCopy
I pasted that into Excel and it worked fine. When I run it as a Maco,
it pastes the last selected cell on the left side:
SelectTimescaleRange Row:=(i * 6 - 4), StartTime:=FY07, Width:=1,
Height:=1
EditCopy
xlApp.ActiveSheet.Paste
The (i*6-4) part is because I have three rows of time phase data for
every row (cost, baseline, actual). That much works because I see the
right cells get highlighted.
Is there any good reason why this works when I do it by hand, but not
when I script it, using the exact recorded macro?
Also, when I clicked between the left and right sides of the usage
view, "NextPane" was recorded. According the help documentation, that
only has to do with the top and bottom panes, so I don't know why I
was seeing that. I tried it with "Next Pane" and without, and had the
same results.
I think the root of my problem is that I can't see what the
SelectTimeScaleRange method does. According to the documentation it
selects timescale data cells in the usage view. This doesn't seem to
change the ActiveSelection, and I can't find any effect anywhere in
the Application object when I do this. Do I need to make this
selection the ActiveSelection or add it to the ActiveSelection (both
of which also sound wrong)?
Running Standard 2003 SP 2 BTW. Any thoughts? I am stumped.