Hello, I am using Active Perl 5.8.0 Build 819 and have created a program which will parse data out of a MS Access DB. I am then taking the data parsed and output it formated in Excel using the Win32::OLE. The problem I am having is when I try to generate a Line Graph. I got some sample code and was trying it but seems like I get an error when running it. The error is the following:

Can't call method "SetSourceData" without a package or object reference at Processor.pl line 893.

The Code I am using is as follows:
use OLE; use Win32::OLE qw(in with); use Win32::OLE::Const "Microsoft Excel"; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); $Excel = Win32::OLE->GetActiveObject('Excel.Application')||Win32::OLE- +>new('Excel.Application','Quit'); $Excel->{DisplayAlerts}=0; $Excel->{SheetsInNewWorkbook} = 16; $Book = $Excel->Workbooks->Add; $mcr_crtab_chart_sheet_name = "CreateTime_Chart"; $chart_sheet = $Book->Worksheets(16); $chart_sheet->{Name} = $mcr_crtab_chart_sheet_name; $mcr_crtime_chart = $Excel->Charts-Add; $mcr_crtime_chart->{ChartType} = xlLineMarkers; # or 65 $mcr_crtime_chart->SetSourceData({Source => $mcrsa_crtab_sheet->Rang +e("B1:F12"),PlotBy => xlColumns}); $range_1 = $mcrsa_crtab_sheet->Range("C2:C$row"); $range_2 = $mcrsa_crtab_sheet->Range("D2:D$row"); $mcr_crtime_chart->SeriesCollection(1)->LetProperty('XValues',$range +_1); $mcr_crtime_chart->SeriesCollection(1)->{Name} = "Series1"; $mcr_crtime_chart->SeriesCollection(2)->LetProperty('XValues',$range +_2); $mcr_crtime_chart->SeriesCollection(2)->{Name} = "Series2"; $mcr_crtime_chart->SeriesCollection(1)->ApplyDataLabels( { AutoText +=> 1,ShowValue => 1 } ); $mcr_crtime_chart->SeriesCollection(2)->ApplyDataLabels( { AutoText +=> 1,ShowValue => 1 } ); $mcr_crtime_chart->{HasLegend} = 1; $mcr_crtime_chart->Legend->{Position} = xlRight; $mcr_crtime_chart->{HasTitle} = 1; $mcr_crtime_chart->ChartTitle->{Text} = "CreateTime"; $mcr_crtime_chart->Axes(xlCategory,xlPrimary)->{HasTitle} = 1; $mcr_crtime_chart->Axes(xlCategory,xlPrimary)->AxisTitle->{Text} = " +Create Time (sec)"; $mcr_crtime_chart->Location({Where=> xlLocationAsObject, Name=> $mcr +_crtab_chart_sheet_name}); $Excel->{ActiveChart}->{Parent}->{top} = 10; $Excel->{ActiveChart}->{Parent}->{left} = 10;
If anyone has any suggestions they would be greatly appreciated. Thanks in advance!

In reply to Need Help with Creating Excel Line Chart using Win32:OLE by ralife

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.