Everything but the column: win32::OLE Excel fun

Everything but the column: win32::OLE Excel fun

am 08.06.2006 03:07:50 von Phil

This doesn't print out anything. I want it to print the desired
range I selected in the $array declaration.

I appreciate any insights!

Thanks,

-Phil

/////////////////////////////


use Win32::OLE;

eval {$Excel = Win32::OLE->GetActiveObject('Excel.Application')};
die "Excel not installed" if $@;
unless (defined $ex) {
$Excel = Win32::OLE->new('Excel.Application', sub
{$_[0]->Quit;})
or die "Oops, cannot start Excel";
}
$Excel = Win32::OLE->GetActiveObject('Excel.Application');

$Book = $Excel->Workbooks->Open('C:\Documents and
Settings\pvernes\Desktop\CDS CORRELATOIN
PROJECT\Ford_equity_cds_data2.xls'); # open Excel file

$Sheet = $Book->Worksheets(1); # select worksheet
number 1
$array = $Sheet->Range('AA6:AA508')->{value}; # get the contents

$Book->Close;

foreach $array (@array) {
print $array;

}

Re: Everything but the column: win32::OLE Excel fun

am 08.06.2006 03:57:23 von John Bokma

"Phil" wrote:

> use Win32::OLE;
>
> eval {$Excel = Win32::OLE->GetActiveObject('Excel.Application')};
> die "Excel not installed" if $@;
> unless (defined $ex) {


$ex?



--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/

Re: Everything but the column: win32::OLE Excel fun

am 08.06.2006 14:52:12 von unknown

Phil wrote:

> This doesn't print out anything. I want it to print the desired
> range I selected in the $array declaration.
>
> I appreciate any insights!
>
> Thanks,
>
> -Phil
>
> /////////////////////////////
>

use strict;
use warnings;

# Then fix up the errors you get.

>
> use Win32::OLE;
>
> eval {$Excel = Win32::OLE->GetActiveObject('Excel.Application')};
> die "Excel not installed" if $@;
> unless (defined $ex) {
> $Excel = Win32::OLE->new('Excel.Application', sub
> {$_[0]->Quit;})
> or die "Oops, cannot start Excel";
> }
> $Excel = Win32::OLE->GetActiveObject('Excel.Application');
>
> $Book = $Excel->Workbooks->Open('C:\Documents and
> Settings\pvernes\Desktop\CDS CORRELATOIN
> PROJECT\Ford_equity_cds_data2.xls'); # open Excel file
>
> $Sheet = $Book->Worksheets(1); # select worksheet
> number 1
> $array = $Sheet->Range('AA6:AA508')->{value}; # get the contents
>
> $Book->Close;
>

# This loop does not print anything because the above code
# does not put anything in @array.

> foreach $array (@array) {
> print $array;
>
> }
>

__END__

Tom Wyant