in reply to Multiple Charts in Excel

The "ChartObject" object has properties left and top which will move the chart. ChartObject from MSDN

Replies are listed 'Best First'.
Re: Re: Multiple Charts in Excel
by vitaliy (Initiate) on Jun 23, 2003 at 16:29 UTC
    Could you please be more specific how to use those properties. I tried:
    $Chart->{Name} = "$curr_graph"; $Chart->{ChartType} = xlXYColumn; $Chart->{Top}=10; $Chart->{Left}=0;
    But it didn't work. THanks, Vitaliy
      The object hierarchy that OLE uses is odd, but it makes sense once you understand it.

      Code has been tested and does work.
      #!/Perl/bin/perl use Win32::OLE #Make new object my $excel = Win32::OLE->new('Excel.Application') or die "$!"; #Open the file $excel->Workbooks->Open("c:\\test.xls") or die "$!"; #Get the chart collection..the Item method returns the nth #item in the worksheets collection $charts = $excel->Worksheets->Item(1)->ChartObjects(); #find out how many you have $chart_count = $charts->{Count}; #loop and chage their left and top properties #again the item property returns the nth item in the #charts list for(my $i=1; $i =< $chart_count; $i++) { $charts->Item($i)->{Left}=XXXX; $charts->Item($i)->{Top}=XXXX }