I have some Win32::OLE code interfacing with Excel, and I get an error when I try to access the select property of the range class. The OLE-Browser validates that range has a selection property, I've done code like this before accessing it, but all of a sudden I'm getting the error (the one in the title).
the code looks like this
my ($rest,$imc);
for my $i (0..$Groups+1) {
for my $j (15*($i+1)-$Conds..15*($i+1)) {
$avg->Range(xl_rowcol_to_cell($j-1,2*$Meas+5))->Select();
$rest = 2*$Meas+4;
$imc = 2*$Meas+3;
$Xl->ActiveCell->{Value} = "=ABS(RC[-$rest]-RC[-$imc])";
$avg->Range(xl_rowcol_to_cell($j-1,2*$Meas+6))->Select();
$rest = 2*$Meas+3;
$imc = 2*$Meas+2;
$Xl->ActiveCell->{Value} = "=Abs(RC[-$rest]-RC[-$imc])";
if($i == 0) {
$avg->Range(xl_rowcol_to_cell($j-1,2*$Meas+7))->Select();
$rest = 2*$Meas+2;
$imc = 2*$Meas+1;
$Xl->ActiveCell->{Value} = "=Abs(RC[-$rest]-RC[-$imc])";
}
}
}
I get a long line of these:
OLE exception from "Microsoft Excel":
Unable to get the Select property of the Range class
Win32::OLE(0.1502) error 0x800a03ec
in METHOD/PROPERTYGET "Select" at dyna.pl line 281
OLE exception from "Microsoft Excel":
Anything wrong with the code? ($Xl is an excel object made with Win32::OLE->new, $avg is a worksheet--I write on it elsewhere/do some formatting and it works, so I know that isn't the problem)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.