Ask a Question

Clicking the wrong item in the table

SOLVED
salley
Frequent Contributor

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.

 

6 REPLIES 6
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
Frequent Contributor

Right I want to match the exact string ,,,
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

salley
Frequent Contributor

Thank you so much , I will give it a try and let y know , so what if there is more than one items in the table with the same string ? Which item will it click
Marsha_R
Champion Level 3

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

salley
Frequent Contributor

Thanks a lot, I appreciate you taking your time. Thanks again
cancel
Showing results for 
Search instead for 
Did you mean: