With reference to this question VBA XMLHTTP clear authentication? I am also trying to pass basic authentication in VBA. It works perfectly.
My only concern is login pop up which comes up whenever a wrong userid or password is sent in request. Is there a way to disable this and send a message box to user from VBA itself telling him about authentication failure?
Update
VBA code:
Dim objHTTP As New MSXML2.XMLHTTP60
With objHTTP
.Open "GET", UrlUserService, False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "Cache-Control", "no-cache"
.setRequestHeader "Authorization", "Basic " + Base64Encode(userName + ":" + userPwd)
.setRequestHeader "Pragma", "no-cache"
.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
.send ""
response = .Status
End With