XMLHTTP problems


New Member
Dec 3, 2011
I'm trying to extract data from some webpages. I'm pulling in the html with an XMLHTTP object and extracting the desired information with Regex.

The following code works fine for vanilla ".html" pages:
    Dim pageHTML As String
    Dim oXMLHTTP As Object
    Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
    oXMLHTTP.Open "GET", urlString, False
    oXMLHTTP.send ""
    If oXMLHTTP.Status <> 200 Then
        errorStr = oXMLHTTP.statusText
        GoTo HandleError
        htmlStr= oXMLHTTP.responseText
    End If
In that case, I get the full html code into htmlStr, whence I can extract the desired info.

:mad: BUT :mad:

When I try it on other sorts of pages, such as .asp and .php, all I get in oXMLHTTP.responseText is a "html" tag.

I'm trying to parse simple pages - ones that take no variables or parameters. E.g.: http://www.quoteland.com/random.asp . I just want to get back the html code that shows up as the page source in my browser when I surf to such sites.

After several hours of searching the web, all I've been able to come up with is that maybe I need to do something with setRequestHeader. Or maybe I need some sort of "POST" rather than "GET". Or something.

Nowhere have I been able to find a simple explanation of the XMLHTTP functionality, nor instructions on how I need to configure the object in order to get the HTML code generated by .asp, .php, and similarly flavored URLs.

Um.... HELP?!!! :confused:


Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.


New Member
May 10, 2011
"Nowhere have I been able to find a simple explanation of the XMLHTTP functionality"

Tell me about it!!! I found out about it a couple of days ago and the only thing online I can find are "this is how to go to a page and get the results" ??? I don't think hardly any of the experts even know how to use xmlhttp in vba. Frustrating!

Watch MrExcel Video

Forum statistics

Latest member
Gregor Lockyer

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...