Hi everyone,
I have the following simple code that works well on my computer (Windows 7, Excel 2013, IE11) but not on my friend's computer (Windows 7, Excel 2010, IE11). The code errors on the getElementById line. Whenever "getElementById" appears anywhere in the full code, we get a run-time error 13 (type mismatch) on his computer. I've tested getElementsByClassName in the same position and it works fine. It seems like a strange, simple error but haven't found anyone on the forums who's come across this before. Can anyone generate this error? Microsoft HTML Object Library and Microsoft Internet Controls are references. Any help would be appreciated.
Cheers, Rob
Sub getElementByIdIssue()
Dim IE As InternetExplorer
Set IE = New InternetExplorer
IE.Visible = False
IE.Navigate ("http://www.racingandsports.com.au/en/form-guide/")
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim CountryHTML As String
CountryHTML = Doc.getElementById("accordion36").innerHTML
Range("A1") = CountryHTML 'added this line here just to test it's working
IE.Quit
'...(pull out various bits of data in the full code)
End Sub
Bookmarks