Re: How to handle a find failure when examining an excel file

2007-11-28 Thread Deane . Rothenmaier
Paul Rousseau sent the following code:

   $row = $Sheet-UsedRange-Find ({What = ParentItemName, 
SearchDirection = xlNext, SearchOrder = xlByRows}) - {Row};

I've never worked with Perl-Excel, so this is something of a SWAG, 
but...could you wrap the assignment in an eval block and then test $@ for 
failure?

HTH

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150

A word to the wise ain't necessary, it's the stupid ones who need the 
advice. -- Bill Cosby___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to handle a find failure when examining an excel file

2007-11-27 Thread Jan Dubois
my $range = $Sheet-UsedRange-Find ({What = ParentItemName, SearchDirection 
= xlNext, SearchOrder = xlByRows});

if ($range) {

my $row = $range-Row;

# .

}

 

Cheers,

-Jan

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul
Rousseau
Sent: November 27, 2007 3:48 PM
To: perl Win32-users
Subject: How to handle a find failure when examining an excel file

 

Hello,
 
   I want my code to be able to handle the following find statement when it 
fails to find the text in the 'What' argument.
 
   $row = $Sheet-UsedRange-Find ({What = ParentItemName, SearchDirection 
= xlNext, SearchOrder = xlByRows}) - {Row};

If the text, ParentItemName, does not exist in the affected worksheet, I get 
the following hash error.
 
 
 
Can't use an undefined value as a HASH reference at c:\images\PKSortExport.pl 
line 441, STDIN line 2
 
 
 
 
I could bog you down with the rest of the code, but it might better if someone 
could simply send me a link to the basic code to
handle a find failure when using Perl to look in a workbook's worksheet for a 
string.
 
Thank you.
 
 
 

  _  

Are you ready for Windows Live Messenger Beta 8.5 ? Get 
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger  the latest for
free today!

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs