Chris Cooper Chris Cooper - 8 months ago 56
HTML Question

How to click on that form?

I am not familiar with html and I am trying to submit a form from VBA.
I managed to select it, but then is there a special command to send it ?

This is what the form looks like..

I tried to click on it to submit it, but this doesn't work.


I know my attempts sound poor, but I was at first trying to click on element which had a onclick property which returns false and I didn't manage to get this to work.
I found an other solution which worked but made the whole code crash at some point, this solution was to use the SendKeys method. You can see the article

Running Click event with no result

my colleague posted about it

Any tips are welcome.

EDIT : Bigger picture of the HTML code with full form

Answer Source

This is how I'd go about it, using SO as the URL

Sub x()

Dim ie As SHDocVw.InternetExplorer
Dim f As MSHTML.HTMLFormElement

Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.navigate ""

Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy

Set f = ie.document.getElementsByTagName("form")(0)

End Sub