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
Private Const ERROR_SUCCESS As Long = 0
Sub LancementProcedure()
DownloadFile "http://www.leSite/fichier.txt", "C:\fichier.txt"
End Sub
Public Function DownloadFile(ByVal sURL As String, ByVal sLocalFile As String) As Boolean
Dim lngRetVal As Long
DownloadFile = URLDownloadToFile(0&, sURL, sLocalFile, 0&, 0& ) = ERROR_SUCCESS
End Function
|