question

MichaelKaplan-9986 avatar image
1 Vote"
MichaelKaplan-9986 asked Viorel-1 answered

Using VBA after Internet Exploer goes away, how to receive web page text

After IE goes away I still need using VBA to be able to request a web page and receive the retuned contents.
Here is a test call i put together for this forum:
The main thing is to be able to use some browser after IE goes away and to be able to receive the output from the website.
Thanks ahead of time for any help.
- Mike -

Sub testcall()
Dim http As Object
Dim JSON As Object
Dim IE As Object
Dim IE_URL As String

 Set IE = CreateObject("InternetExplorer.Application")
 With IE
     .Visible = True
     IE_URL = "http://www.vbaexpress.com/"
     .Navigate IE_URL, 14, "_self", Null ', header2
     Do Until .readyState = 4: Application.Wait (Now + TimeValue("0:00:01")): Loop
     Debug.Print .document.body.innerText
   '  Set oJson = ParseJSONx(.document.body.innerText)
 End With

End Sub

office-vba-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered

Check an alternative:

 Dim x
 Set x = CreateObject("MSXML2.XMLHTTP")
    
 x.Open "GET", "http://. . . .", False
 x.Send
    
 Dim result As String
 result = x.responseText

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.