perl, ole, excel's Find(), Q1

Discussion in 'Perl Misc' started by werwer, Sep 26, 2005.

  1. werwer

    werwer Guest

    Getting help on this one has been tuff, so I'll take it in
    steps.

    I'm trying to use Excel's (2003) Find() function. This is what I
    have so far.

    sheets:
    foreach my $ws (in $MyWorkbook->Sheets) {
    print qq/Sheet $sheetName\n/;

    # Can I get a range object and print a value?
    my $cell = $ws->Range("A1");
    my $ro = $cell->{Value};
    print qq/TEST01 cell value $ro\n/;

    $cell = $ws->Find('What:="2"', 'After:=ActiveCell',
    'LookIn:=xlValues', 'LookAt:=xlPart', 'SearchOrder:=xlByRows',
    'SearchDirection:=xlNext', 'MatchCase:=False',
    'SearchFormat:=False');

    # Nothing here.
    $ro = $cell->{Value};
    print qq/TEST0102 cell value $ro\n/;

    } # sheets:


    My 1st question is. Are the arguments to Find being constructed
    correctly? Not are these the correct argunments, but is
    'After:=ActiveCell'
    properly formed. I tried other variations, no quotes, quotes, and
    actually assigning a numeric value. Nothing seemed to work.
    I've also tried every which way to enter that '2' in What:=

    The above doesn't bomb, it just doesn't ever succeed.

    Thanks
     
    werwer, Sep 26, 2005
    #1
    1. Advertising

  2. werwer

    werwer Guest

    Well well... another post got it answered. THe key is the
    function has to be called on a range object, as in

    $ws->UsedRange->Find().

    Thanks.
     
    werwer, Sep 26, 2005
    #2
    1. Advertising

  3. werwer

    werwer Guest

    Another post answered it. find() must be called from, or on,
    a range object like:

    $ws->UsedRange->Find()

    Thanks
     
    werwer, Sep 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick.O.Ige

    Ole ole

    Patrick.O.Ige, Jul 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    500
    Patrick.O.Ige
    Jul 16, 2006
  2. Drew Pihera
    Replies:
    0
    Views:
    648
    Drew Pihera
    Feb 4, 2004
  3. Lance Hoffmeyer
    Replies:
    0
    Views:
    245
    Lance Hoffmeyer
    Nov 17, 2003
  4. Replies:
    1
    Views:
    833
  5. TimmyD
    Replies:
    0
    Views:
    181
    TimmyD
    Apr 21, 2005
Loading...

Share This Page