Excel VBA: Fastest Method: Retrieve XML

What is the fastest VBA code that can be used to retrieve xml from any website and put it in a string variable?
ouestqueAsked:
Who is Participating?
 
aikimarkCommented:
This is my go-to VBA code
    Dim oXMLHTTP As Object
    Dim strHTML as string
    Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP")
    oXMLHTTP.Open "GET", "http://yourtargetwebsiteURL", False
    oXMLHTTP.Send
    
    Do Until oXMLHTTP.ReadyState = 4
        DoEvents
    Loop
    
    If oXMLHTTP.Status = 200 Then
        strHTML = oXMLHTTP.responsetext
        'add your parsing code here
    End If

Open in new window

0
 
aikimarkCommented:
Is this a SOAP call?
Once you get the XML, are you going to put the entire XML string into a single cell or parse the result into multiple cells?
0
 
ouestqueAuthor Commented:
I am going to parse the string
0
 
ouestqueAuthor Commented:
Thanks again Aikmark! Nice Code!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.