I have an Excel VBA macro which does the equivalent of the following HTTP POST which works successfully:
Set WebClient = CreateObject("WinHttp.WinHttpRequest.5.1")
' ... Configure WebClient for a POST request
RequestBody = "<request>"
WebClient.send RequestBody
Previously, I had explicitly set the type of RequestBody as a String as in the following:
Set WebClient = CreateObject("WinHttp.WinHttpRequest.5.1")
' ... Configure WebClient for a POST request
Dim RequestBody As String
RequestBody = "<request>"
WebClient.send RequestBody
This appeared to work correctly except that the server received no request content.
On debugging through both versions a watch on RequestBody described its type as 'Variant/String' and the content was correct.
Why does the addition of a type cause this issue?