in reply to Using Win32:OLE on Excel
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using Win32:OLE on Excel
by connerz (Initiate) on Jul 01, 2002 at 19:41 UTC | |
by cacharbe (Curate) on Jul 01, 2002 at 19:49 UTC |