Skip to content Skip to sidebar Skip to footer

VBA GetElementById Doesn't Work For Button

I am trying to go on a website, type a value in a textbox and then click the searchbutton to search for my value. My Problem is, that i can't get the button element, to fire the cl

Solution 1:

Replace:

IE.Document.getElementbyid("(page.navid=to_quicksearchlist)").Click

with:

Set x = IE.Document.GetElementsByName("(page.navid=to_quicksearchlist)")
x(0).Click

You need to look for the element by the Name not the Id


Solution 2:

You are using getElementById, which looks for the id of an element.

Your input button does not have any id attribute set, and this is why you cannot find it.

Add a value for the id attribute as so, and you will see it working:

<input id="xyz" ... />

Then:

IE.Document.getElementbyid("xyz").Click

Post a Comment for "VBA GetElementById Doesn't Work For Button"