Excel VBA XML HTTP - Code not working on Windows 8 -


I have the following function that returns the HTML document for the URL I use the HTML Doc given in another function I am here.

The function works perfectly on Windows 7, but not on window 8, unfortunately, does anyone help me write written code that works on both Windows 7 and 8? I think I need to use a different version of the XML HTTP object.

  Reset global variable in the form of GetHtmlDoc (object DM) as the string in the form of a string) PageSrc = Set "html" = Create object with nothing (" MSXML2.XMLHTTP "). Open "GET", URL, True .Set while .readyState & lt; & Gt; 4: Doovents: Wend A = .statusText 'Check for any server errors if .statusText & lt; & Gt; "OK" then check for 'WinHTTP error' Msg = GetWinHttpErrorMsg (.Status) 'if msg = "msg msg = .statusText' error number and return message GetPageSource =" Error: "& amp; Titas & amp; "-" & amp; Close the Msg function if the HTML code in the global variable is saved PageSrc =. 'Create an empty HTML document' HtmlDoc = CreateObject ("htmlfile") Set html.doc.Open URL: = "text / html", Change: = Convert the wrong HTML code to an HTML document object. HtmlDoc.write PageSrc 'End Input Output with Global Variables Return the HTML text of the web page' Htmldoc.Close '' GetHtmlDoc = Set the htmlDoc closing function  

Example function call: <

Div class = "post-text" itemprop = "text"> XMLHTTP code> server XMLHTTP :

  with CreateObject ("MSXML2 .ServerXMLHTTP "). Open "GET", URL is incorrect  

(enclosing < readyState loop requirement.


Comments