No, I'm using Win32::OLE because I have to create graphs in excel and move them to powerpoint (apparently powerpoint is the only language my boss understands).

What I am doing is creating a graph. The entire code is:

$data[0]='162|There is a Project Management office in place that monit +ors, participates and reports on projects|7|0'; $data[1]='163|There is a PMO that provides policies/procedures/tools f +or project planning/tracking, which are used regularly|0|0'; $data[2]='164|There is no PMO, however, formal policies/procedures/too +ls exist are used regularly|46|0'; $data[3]='165|Formal policies/procedures/tools exist but are not used| +0|0'; $data[4]='166|Ad hoc, no formal policies/procedures|46|1'; $qid=65; $binst=10; $cname='Client Name'; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; $Win32::OLE::Warn = 3; $Excel = Win32::OLE->new('Excel.Application') or die "oops\n"; my $Book = $Excel->Workbooks->Open("c:\\stage\\scratch.xls"); my $Sheet = $Book->Worksheets("data"); # skip empty cells $row=1; $col=1; $x=0; $y=1; for (@data){ $x++; ($id,$label,$value,$checked)=split(/\|/); $Sheet->Cells($row,$col)->{'Value'}=$label; $Sheet->Cells($row,$col+1)->{'Value'}=$value; $Sheet->Cells($row,$col+2)->{'Value'}=$checked; if($checked==1){ $y=$x; } $row++; } my $Range = $Sheet->Range("A1:B5"); my $Chart = $Book->Charts->Add; $Chart->ChartWizard($Range,xlPie,6,xlColumns,1,0,1,"Approach to Projec +t Management"); $text=$Chart->SeriesCollection(1)->Points(1)->DataLabel->{Text}; $Chart->SeriesCollection(1)->Points($y)->DataLabel->{Text} = "$cname\n +$text"; $Chart->Legend->{Position} = xlLegendPositionBottom; $Book->Close;

It is a test for creating multiple graphs in Excel.

Any ideas on the syntax?


In reply to Re: Re: OLE::WIN32 Excel Range Selection by mitchems
in thread OLE::WIN32 Excel Range Selection by mitchems

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.