I am creating a stream from an excel file, and need to post it to a web service. When I try 'MsgBox objStream.Size' it will give me the full file size, but after I post to my service and check the length of the stream, it is 0. Am I sending the POST correctly?
Sub postStreamToService()
Dim oRequest As Object
Dim objStream As ADODB.stream
Set oRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
Set objStream = New ADODB.stream
objStream.Open
objStream.LoadFromFile "C:\Users\Desktop\excel\test.xls"
oRequest.Open "POST", "http://localhost:52670/Service1.svc/PostFile"
oRequest.setRequestHeader "Content-Type", "vnd.ms-excel"
oRequest.Send objStream.Read
objStream.Close
Set objStream = Nothing
Set oRequest = Nothing
End Sub