I'm using WinHTTP to do a GET request in an Excel VBA Macro. However, if I try to do the request from a machine in a network with a proxy, it does not work. If I configure it manually, it works, but I don't think the people who'll use the tool I'm developing will know their proxy servers.
Is there a way to autoconfigure the proxy server, or to get the proxy configuration from Windows? Here follows a sample code:
Dim result As String
Dim URL As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "http://google.com/"
winHttpReq.Open "GET", URL, False
winHttpReq.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
winHttpReq.setProxy 2, "proxyserver:8080", ""
winHttpReq.send
result = winHttpReq.responseText
In this case, I don't want to force the user to find the "proxyserver:8080" address - what I want is a way to fill that automatically.
Thanks a lot.