|
Posted by harryfmudd [AT] comcast [DOT] on June 8, 2006, 8:52 am
Please log in for more thread options
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
> )
> 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')->; # 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
|