Click here to get back home

Everything but the column: win32::OLE Excel fun

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Everything but the column: win32::OLE Excel fun Phil 06-07-2006
Posted by Phil on June 7, 2006, 9:07 pm
Please log in for more thread options


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
)
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;

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

}


Posted by John Bokma on June 7, 2006, 9:57 pm
Please log in for more thread options



> 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/

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

Similar ThreadsPosted
Win32::ODBC Find Primary Key Column February 6, 2005, 8:21 pm
Find Missing Column and Extra Column March 12, 2007, 6:33 am
Win32::OLE::Const 'Microsoft Excel' - sort & freeze pane April 30, 2008, 12:48 am
find a first column value ... May 19, 2006, 12:54 pm
HTML::TableExtract with headers constraint, exluding right-most column May 15, 2005, 3:31 pm
Help Perl and Excel August 16, 2006, 9:25 am
OLE Excel AutoFilter September 10, 2006, 4:28 pm
Perl and Excel April 6, 2007, 1:06 am
Excel Data conversion July 27, 2004, 2:37 pm
Problem with Name of Excel Chart September 22, 2005, 9:21 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap