problem with pivot table automation using perl
I'm using perl win32::ole trying to automate some pivot table stuff.
I saw a post that indicated direct manipluation of pivot tables with
perl
may not be supported. I tried a different route.
We get a workbook that has several worksheets, each worksheet
has the same colum types but different data. I created a macro
to create a pivot table from a worksheet called "pivot_source".
Then I rename each worksheet to pivot_source, (eg I rename Sheet3 to
pivot_source).
I then run the macro which creates a pivot table from pivot_source,
then I rename pivot_source back to something else like old_source3 or
something
and go to the next worksheet. If I do this by hand, renameing each
worksheet
and then running the macro, it seems to work.
but if in perl I do something like
$worksheet = $workbooks-WorkSheets("Sheet3");
$worksheet-Activate();
$worksheet-{Name} = "pivot_source";
$Excel-Run("pivotMacro");
$worksheet-{Name}= "oldsource3";
it seems to work OK for the first invocation, but when it gets to doing
the second pivot table it dies. This isn't the exact code I use, but
it looks something like that. I use variables instead of literals since
I am doing multiple invocations. Even if I save the .xls file,
after each macro run and start afresh, I have the same problem.
Any help would be greatly appreciated ..
|