how to double click web object in VBA

2019-09-03 09:04发布

问题:

I am automating a web process with VBA. I go find an object on a webpage using

IE.document.getelementsbytagname

etc.. Once that object is found, you can single click using

 objElement.click

The question is, how do I double click?? All my searches have come up with nothing. I thought dblClick or doubleClick would do the trick, but those are invalid methods. I tried a workaround by using

objElement.click
sendkeys "{ENTER}"

to click and then hitting enter would open the link, but that doesn't work either.

回答1:

I finally got this working:

objElement.click
objElement.FireEvent "ondblclick", 1, 2