Reputation: 29
I have Access VBA scripts to pull data from a number of web sites. These worked perfectly with office 2013 and Windows 7. However, since upgrading to Windows 10 I have been getting intermittent errors (not necessarily in the same place with the same data) or sometimes data is not being extracted from the tags. It appears too occur when I access a specific tag with a specific index e.g.
tempV = TDelement.getElementsByTagName("td")(0).innerText
I'm using IE as the browser object created as follows:
Set objIE = CreateObject("InternetExplorer.Application")
Is there anything that upgrading Windows could have broken? (Novice, so apologies for any incorrect terminology)
Upvotes: 1
Views: 532
Reputation: 107707
Consider using the MSXML's IXMLHTTPRequest object for web server requests. IE is no longer a dedicated browser on Windows, so may not fully support automation going forward with Windows 10.
Dim Req As Object, xmlobj As Object
Dim strWeb As String, myFile As String
' READ HTML PAGE
Set Req = CreateObject("MSXML2.XMLHTTP")
Req.Open "GET", "http://www.example.coms/", False
Req.send
' HTML/TEXT
strWeb = Req.responseText
myFile = "C:\Path\To\File.txt"
Open myFile For Output As #1
Write #1, strWeb
Close #1
' XML
Set xmlObj = CreateObject("MSXML2.DOMDocument")
myFile = "C:\Path\To\File.xml"
xmlObj.LoadXML Req.responseText
xmlObj.Save myFile
Set Req = Nothing
Set xmlObj = Nothing
Upvotes: 2