Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Can't Find my way in Excel

by Corion (Pope)
on Sep 17, 2019 at 17:07 UTC ( #11106305=note: print w/replies, xml ) Need Help??


in reply to Can't Find my way in Excel

Have you tried

$loc = $Sheet->UsedRange->Cells->Find( { What =>"cabbage" })

The Win32::OLE documentation suggests passing a hashref when you want to use named parameters.

Also, did you run your code with warnings or the -w command line switch? Perl will tell you about problems in your code if you let it.

Update: Also try:

$loc = $Sheet->UsedRange->Cells->Find( What =>"cabbage" )

Replies are listed 'Best First'.
Re^2: Can't Find my way in Excel
by ExReg (Priest) on Sep 17, 2019 at 17:20 UTC

    I have tried that. It errors with "Undefined subroutine &main...". $Sheets, $Sheets->UsedRange, and $Sheets->UsedRange->Cells all return Win32 hashes, but I can't get that last step with Find.

      Please tell us the exact and complete error message. Otherwise, we can't know what exactly goes wrong with your script.

        Sorry, "Undefined subroutine &main:: called at (eval 14)D:/software/Perl/lib/perl5db.pl:646 line 2, <$lh> line 7." This is the error I see in perl's debugger as I try each variation. If I try just running it without debug, I get "Can't use string ("") as a subroutine while "strict refs" in use at search.pl line 100, <$lh> line 7." That is true if the curlies are around the whole expression inside the parens or not. Without "use strict" I get the Undefined subroutine error.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11106305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2019-11-22 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (108 votes). Check out past polls.

    Notices?