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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marsha_R
Community Hero

Re: Clicking the wrong item in the table

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

View solution in original post

6 REPLIES 6
Marsha_R
Community Hero

Re: Clicking the wrong item in the table

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

Re: Clicking the wrong item in the table

Right I want to match the exact string ,,,
Marsha_R
Community Hero

Re: Clicking the wrong item in the table

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

Re: Clicking the wrong item in the table

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
Community Hero

Re: Clicking the wrong item in the table

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

View solution in original post

salley
Frequent Contributor

Re: Clicking the wrong item in the table

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