title: URLDownloadToFile - Data missing in downloaded file
body: <p>Using <code>URLDownloadToFile</code> in VBA, I am trying to download a file. The problem is that a blank file is getting downloaded. Any idea why the data is missing?</p>
  
  <pre><code>Option Explicit 
  
  Private Declare Function URLDownloadToFile Lib "urlmon" _ 
  Alias "URLDownloadToFileA" (ByVal pCaller As Long, _ 
  ByVal szURL As String, ByVal szFileName As String, _ 
  ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long 
  
  Dim Ret As Long 
  
  Sub Sample()
  
  Dim strURL As String 
  Dim strPath As String 
  
  strURL = "https://abc.abcabc.com/cmif-ku/reports/2012/byOwningEntity/Excel/myfilename.xls" 
  
  strPath = "C:\Temp\myfilename.xls" 
  
  Ret = URLDownloadToFile(0, strURL, strPath, 0, 0) 
  
  If Ret = 0 Then 
      MsgBox "File successfully downloaded" 
  Else 
      MsgBox "Unable to download the file" 
  End If
  
  End Sub
  </code></pre>