I'm trying to do a GET in VBA in Excel, and found several examples, below what I'm using:
Sub http()
Dim MyRequest As Object
Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
MyRequest.Open "GET", "http://www.google.com", False
MyRequest.Send
MsgBox MyRequest.ResponseText
End Sub
In all of the examples I tested, it shows the following error when running MyRequest.Send
:
"Run-time error '-2147012889 (80072ee7)':
The Server Name or Address can not be resolved "
You already include the Microsoft WinHTTP Services, version 5.1
reference in my project.
What may be happening or missing?
EDIT
I also tried changing it:
MyRequest.Open "GET", "http://www.google.com", True
Displays the following error:
"Run-time error '-2147483638 (8000000a)':
Data needed to complete this operation is not yet available "
NOTE: The network here in the company is protected by firewall