ilikeminis has asked for the wisdom of the Perl Monks concerning the following question:
...$FALSE = 0; $TRUE = 1;
...my $Excel = &openExcel(); my $filename = "<filename>"; my $book = &openBook($Excel, $filename); my $ClosedSheet = $book->Worksheets("Closed");
...my $closedRows = $ClosedSheet -> UsedRange -> Find({What => "*", Searc +hDirection => xlPrevious, SearchOrder => xlByRows}) -> {Row};
Sure, some of this is ugly, but that print statement does output the correct data, so I know I'm getting the correct cell. This is the equivalent VBA code I got from recording an Excel macro:$range = "A1:I" . $closedRows; my $closedRange = $ClosedSheet->Range($range); my $closedPivot = $ClosedSheet->PivotTableWizard(1, $closedRan +ge, $ClosedSheet->Cells($closedRows+2,1), "Closed SPR PivotTable"); # Set pivot fields... $closedPivot->AddFields("date_fixed"); $closedPivot->PivotFields("Product")->{Orientation} = 4; # + 4=xlDataField # Group by days #TODO my $thetargetcell = $ClosedSheet->Cells($closedRows+3, 1)- +>{Value}; print "target val: " . $thetargetcell . "\n"; $ClosedSheet->Cells($closedRows+3, 1)->Group( {Start => $T +RUE, End => $TRUE, By => 1, Periods => [$FALSE, $FALSE, $FALSE, $TRU +E, $FALSE, $FALSE, $FALSE]});
If anyone knows anything, let me know.Range("A460").Select Selection.Group Start:=True, End:=True, By:=1, Periods:=Array(Fals +e, _ False, False, True, False, False, False)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE Range->Group Method
by Anonymous Monk on Nov 02, 2010 at 11:31 UTC | |
by ilikeminis (Initiate) on Nov 02, 2010 at 16:39 UTC |