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. Advertisements

  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. Advertisements

  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. Advertisements

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:
    702
    Patrick.O.Ige
    Jul 16, 2006
  2. Drew Pihera
    Replies:
    0
    Views:
    912
    Drew Pihera
    Feb 4, 2004
  3. Replies:
    1
    Views:
    1,297
  4. TimmyD
    Replies:
    0
    Views:
    314
    TimmyD
    Apr 21, 2005
  5. Replies:
    2
    Views:
    424
    Mark Clements
    Jan 17, 2007
  6. Slickuser

    Perl OLE Excel - STDEVA function

    Slickuser, May 3, 2008, in forum: Perl Misc
    Replies:
    2
    Views:
    348
    Slickuser
    May 3, 2008
  7. Slickuser
    Replies:
    3
    Views:
    479
    Slickuser
    May 9, 2008
  8. Graig
    Replies:
    2
    Views:
    424
    Graig
    May 6, 2009
Loading...