I am trying to download a file from Sharepoint with VBA and can not figure out how to do it! The file is actually a picture (not sure if that matters?) and the download goes fine, but the picture isn't view-able once it gets onto the system. (Code below) I'm thinking that I'm downloading it in the wrong format, but (like I said) I can't figure it out.
Sub DownloadFromSharepoint()
Dim myURL As String
myURL = "https://MYSHAREPOINTSITE"
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False
WinHttpReq.Send
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.ResponseBody
oStream.SaveToFile ("C:\Users\DOMAIN\temp.jpg")
oStream.Close
End If
End Sub