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
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit'); # get already
active Excel
# application
or open new
my $Book = $Excel->Workbooks->Open("C:\\orders.xls"); # open Excel file
my $Sheet = $Book->Worksheets(2); # select
worksheet number 1
print "SHEET: ", $Sheet->Name, "\n";
my $array = $Sheet->Range("G4:H12")->{'Value'}; # get the contents
$Book->Close;
foreach my $ref_array (@$array) { # loop through the array
foreach my $scalar (@$ref_array) {
print valof($scalar),"\t";
}
print "\n";
}
SHEET: Inventory
Order By Qty
Win32::OLE::Variant=SCALAR(0x1a0d108) 400
Win32::OLE::Variant=SCALAR(0x1a10310) 84
Win32::OLE::Variant=SCALAR(0x1a102f8) 100
Win32::OLE::Variant=SCALAR(0x1a102e0) 196
Win32::OLE::Variant=SCALAR(0x1a0d108) 100
Win32::OLE::Variant=SCALAR(0x1a10310) 1
Win32::OLE::Variant=SCALAR(0x1a102f8) 100
Win32::OLE::Variant=SCALAR(0x1a102e0) 200
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>