rob johnson wrote:
> Hi
>
> I am having a difficult time getting Excel automation to work
> correctly.    specifically, i've become hung up on creating multiple
> charts.
>
> I am able to make a basic XY Scatter plot with the following code:
>
> ==================================
> $Sheet->Range("A:A,D:D,K:K,R:R")->Select;
> $Chart = $Book->Charts->Add;
> $Chart->{ChartType} = xlXYScatter;
> $Chart->{Name}="Temperature";
> ==================================
>
> and it correctly charts D, K, and R column data (temperatures) versus
> the A column data (time)
>
> but if i want to make another (separate) chart plotting E, L, and S
> column data (conductivity) versus the A column data (time), and i
> follow the above code with a similar block:
>
> ==================================
> $Sheet->Range("A:A,E:E,L:L,S:S")->Select;
> $Chart = $Book->Charts->Add;
> $Chart->{ChartType} = xlXYScatter;
> $Chart->{Name}="Conductivity";
> ==================================
>
> it fails, with the following error message
>
> ====================================================
> OLE exception from "Microsoft Excel":
>
> Unable to get the Select property of the Range class
>
> Win32::OLE(0.1704) error 0x800a03ec
>     in METHOD/PROPERTYGET "Select" at hexconvert.pl line 322
> ====================================================
>
> (where line 322 is in the second block:
> $Sheet->Range("A:A,E:E,L:L,S:S")->Select; )
>
> Can someone point out where I'm going wrong?
>
> Also, If I could just find a reference of Excel OLE properties and
> methods I think I could hack my way through it.  But I haven't been
> able to find anything like that.
>
> does anyone know if such a list exists?
>
> thanks, 
> rob
>
>   
I know I've faced this in the past after converting recorded macro 
verbatim. I can't easily test a
solution based on your example because it is not 'complete and 
working'... ;-) A couple of things
that might help:

A snippet of mine that sets a range as source for a chart:

$range = "A25:" . $endCol . "26";
$Excel->ActiveSheet->ChartObjects('Chart 1')->Activate();
$Excel->ActiveChart->SetSourceData({Source => $pSheet->Range($range), 
PlotBy => 2});

As I recall, it is possible to skip the ...Activate line and reference 
the ChartObjects(...) instead
of ActiveChart in the line following it.

The VBA editor itself has the Object Browser documentation built-in - 
right-click in editor pane.

Often, pasting the error right into Google yields valuable pointers or 
solutions.

Even though I use perl almost exclusively over VBA I have had excellent 
method advice from contributors
over on microsoft.public.excel.misc.

HTH - Lynn.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to