Forum Discussion

kpinnisetti's avatar
kpinnisetti
Contributor
12 years ago

Using Key"[Down] Until particular object is found by its name.

Can any one help me with sample code how to Use Key"[Down]" Until particular object is found by its name and click enter on that particular object. clickItem Method is not available for the dropdown in our application.

In our Application we have a dropdown,the list will be changing dynamically.




Sub PayPlan


  Dim DeptName


  DeptName = "Operations"


  Set txtBoxDept = Aliases.txtBoxPayPlanSearch 


  txtBoxDept.keys(DeptName)


  txtBoxDept.Keys("[Down][Enter]")


End sub

4 Replies

  •   Hi Tanya,

    That object doesn't have that Items or selectedItem property/Method.

    See the attached screen shot for more information.
  • paul_scroce's avatar
    paul_scroce
    Frequent Contributor
    Perhaps you can use a loop and

    If txtBoxDept.contentText = ExpectedName Then txtBoxDept.Keys("[Enter]")

    but you would also need to know the total number of items in the list to work out how many times to press the Down key before exiting the function if the item is not found.
  • Hi Paul, Thanks for the reply i will try that using loop..But that dropdown values will dynamically changes that the challenge,every time i have count manually how many items are there in that dropdown. But atleast that would help.

    Thank you.