Navigate

Downloads a certain page source into a variable, full content in HTML, using Internet Explorer


Public

Tested

My Own Work
Public Function Navigate(sURL As String, sPostData As String) As String
Dim HttpReq As MSXML2.XMLHTTP, Errcount
Set HttpReq = New MSXML2.XMLHTTP
On Error Resume Next
' HttpReq.Open "POST", sURL, True' toggle the use of these lines if did not work
HttpReq.Open "GET", sURL, True
DoEvents
HttpReq.send sPostData
Do1:
DoEvents
Navigate = HttpReq.responseText
DoEvents
If HttpReq.readyState = 4 Then
Navigate = HttpReq.responseText
DoEvents
Else
DoEvents
GoTo Do1
End If
GoTo ByeBye
Err11:
'Errcount = Errcount + 1
'If Errcount > 10 Then GoTo ByeBye
'Set HttpReq = Nothing
'DoEvents
'Err.Clear
'ReadSStatus
GoTo ByeBye
ByeBye:
Set HttpReq = Nothing
End Function

sURL, sPostData

Views 4507 Downloads 1129

VBA-Excel Components
ANmarAmdeen
655
Attachments
Revisions

v2.0