Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2021-12-09 10:00 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (36 votes). Check out past polls.