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

Reply via email to