title: How to download a file from SharePoint with VBA?
body: <p>I am trying to download a file from SharePoint with VBA.</p>
  <p>The file is a picture but the picture isn't view-able once it gets onto the system.</p>
  <p>I think that I'm downloading it in the wrong format.</p>
  <pre><code>Sub DownloadFromSharepoint()
      Dim myURL As String
      myURL = &quot;https://MYSHAREPOINTSITE&quot;
  
      Dim WinHttpReq As Object
      Set WinHttpReq = CreateObject(&quot;Microsoft.XMLHTTP&quot;)
      WinHttpReq.Open &quot;GET&quot;, myURL, False
      WinHttpReq.Send
  
      If WinHttpReq.Status = 200 Then
          Set oStream = CreateObject(&quot;ADODB.Stream&quot;)
          oStream.Open
          oStream.Type = 1
          oStream.Write WinHttpReq.ResponseBody
          oStream.SaveToFile (&quot;C:\Users\DOMAIN\temp.jpg&quot;)
          oStream.Close
      End If
  End Sub
  </code></pre>