RE: Win32::OLE question(s)



Tim wrote:
> Hello.
>
> The following code produces the output below. The first column should
> be a date. This happens whether the "valof" function is used or not.
> Anyone have any Variant tricks?
>
> Thanks.
> Tim

Read up on the Range property and Cells property.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11
/html/xlproCells1_HV03076630.asp

use strict;
use Win32::OLE qw/in with/;

my $Excel = Win32::OLE->GetActiveObject('Excel.Application') ||
Win32::OLE->new('Excel.Application', 'Quit');
my $Book = $Excel->Workbooks->Open("C:\\orders.xls");
my $Sheet = $Book->Worksheets(2);

for my $cell (in $***->Range("G4:H12"))
{
print "Cell has value ", $cell->Value, "\n";
}
$Book->Close;
.


Quantcast