mohadin
Active Member
Hi Gentlemen
I get this pice of code for the net
it works ok with internet explorer
Because I need to use it with Firefox browser I did some modification to it and I get this below code but I'm not able to have it working.
The line in (HTMLInput.Value = "Excel VBA") is wrong I could not fix it.
may I get any help with this.
Thank you very much
I get this pice of code for the net
it works ok with internet explorer
Code:
Sub GetHTMLDocument()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLButtons As MSHTML.IHTMLElementCollection
Dim HTMLButton As MSHTML.IHTMLElement
IE.Visible = True
IE.navigate "wiseowl.co.uk"
Do While IE.readyState <> READYSTATE_COMPLETE
Loop
Set HTMLDoc = IE.document
Set HTMLInput = HTMLDoc.getElementById("what")
Debug.Print HTMLInput.Value
HTMLInput.Value = "Excel VBA"
Set HTMLButtons = HTMLDoc.getElementsByTagName("button")
' For Each HTMLButton In HTMLButtons
' Debug.Print HTMLButton.className, HTMLButton.tagName, HTMLButton.ID, HTMLButton.innerText
' Next HTMLButton
HTMLButtons(0).Click
End Sub
Because I need to use it with Firefox browser I did some modification to it and I get this below code but I'm not able to have it working.
The line in (HTMLInput.Value = "Excel VBA") is wrong I could not fix it.
may I get any help with this.
Thank you very much
Code:
Sub test()
Dim HTMLInput As MSHTML.HTMLInputElement
Dim XMLPage As New MSXML2.XMLHTTP60
Dim HTMLDoc As New MSHTML.HTMLDocument
XMLPage.Open "GET", "https://www.wiseowl.co.uk/", False
XMLPage.send
HTMLDoc.body.innerHTML = XMLPage.responseText
'Debug.Print HTMLDoc.DocumentElement.innerHTML
Debug.Print HTMLDoc.body.innerHTML
HTMLDoc.body.innerHTML = XMLPage.responseText
Set HTMLInput = HTMLDoc.getElementById("what")
HTMLInput.Value = "Excel VBA"
End Sub
Last edited by a moderator: