title: Difficulites in accessing the Download files dialog box - VBA Code
body: <p>I have mini project in VBA (Excel). I need to open the IE and download the files (save the doc) in the designated folder in my desktop.</p>
  
  <p>However, I having difficulties in accessing the Download files dialog box. Even tried Savekeys concept but in vain.</p>
  
  <p>How to proceed further and save the files?</p>
  
  <pre><code>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
  
  Sub DownloadFileFromWeb()
      Dim myFile As String
      Dim strSavePath As String
      Dim URL As String, ext As String
  
      URL = "www.ahma.org/Education/BRD_Hardlines_Industry_Item.doc" 'for TEST
      strSavePath = "C:\Users\Yogendra.Ur\Desktop\" &amp; "DownloadedFile" &amp; ext
  
      Dim buf, Ret As Long
      buf = Split(URL, ".")
      ext = buf(UBound(buf))
  
      Dim IE As Object
      Set IE = CreateObject("internetexplorer.application")
      IE.VISIBLE = True
      IE.Navigate URL
  
      Ret = URLDownloadToFile(0, URL, strSavePath, 0, 0)
  
      If Ret = 0 Then
          MsgBox "Download has been succeed!"
      Else
          MsgBox "Error"
      End If
  End Sub
  </code></pre>