Forum Discussion

salley's avatar
salley
Frequent Contributor
7 years ago
Solved

Clicking the wrong item in the table

hello,

i've a dynamic table and item displays based on search criteria. my script is able to find the item in the table but always clicks the first cell when the exact match is not on the first Cell. not sure what i'm doing wrong in the code, code is attached. thanks for your help.

 

  • I think your loop will quit on the first match it finds. 

6 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    For arrCount=0 To UBound(arrObjects)
    If arrObjects(arrCount).contentText=strQtName Then
    Set CurrentObj=arrObjects(UBound(arrObjects))
    ObjFound=True
    Exit For
    End If
    Next

     

     

    -----------------------

    It looks to me like when your If statement finds your string, you are always setting the CurrentObj to the object at UBound.  Should it be more like

    Set CurrentObj=arrObjects(arrCount)

    because you want the object that just matched your string, right?

    • salley's avatar
      salley
      Frequent Contributor
      Right I want to match the exact string ,,,
      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Right now when you match the string, you are always saving this Set CurrentObj=arrObjects(UBound(arrObjects))

         

        but the string was found at arrObjects(arrCount) so that's the one you want to save in CurrentObj