More specifically, don't create a new sheet, set :
and you should be able to modify the last row, last column section in the tutorial to work within a given selection, vs. on a given sheet.my $Sheet = $Excel->{ActiveSheet};
Update::
'course, you don't necessarily have to work with that chunk of code, since in this case the Application->Selection object returns a Range object, so you could always just do this:
C-.use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') or die "Ain't gonna work without an open worksheet\n"; my $Sheet = $Excel->{ActiveSheet}; my $array = $Excel->Selection->{Value}; foreach my $cell(@{$array}){ print $cell->[0]."\n"; }
---
Flex the Geek
In reply to Re: Using Win32:OLE on Excel
by cacharbe
in thread Using Win32:OLE on Excel
by connerz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |