2
I am trying to do a GET in VBA in Excel, and found several examples, below is what I am 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 examples I have tested, it shows the following error when running MyRequest.Send
:
"Runtime error '-2147012889 (80072ee7)':
Server name or address cannot be solved"
Already includes the reference Microsoft WinHTTP Services, version 5.1
in my project.
What may be going on or missing?
EDIT
I also tried to change:
MyRequest.Open "GET", "http://www.google.com", True
Displays the following error:
"Runtime error '-2147483638 (8000000a)':
The data required to complete this operation is not yet available"
NOTE: The network here in the company is protected by firewall
I haven’t tried several different sites and the same mistake. So that must be what you said, because I’m trying to do it in the bank where I work and here it’s full of it... What I do not understand is that I can access these sites, but by the excel of this error.
– Lugarini
If the problem is the second option, would have some solution?
– Lugarini
@Thiago I added a manual entry to the firewall and in fact, the error returned was "A connection to the server could not be established" with this, we should also discard the 2nd option. I’ll run another DNS test and get back to you.
– Ismael
This does not provide an answer to the question. To criticize or request clarification from an author, leave a comment below its publication. - From Review
– Andre Figueiredo
@Andrefigueiredo did not answer the question why?
– Jorge B.