1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| 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 _
"ftp://ftp-nomsite.com/rep/nomfichier.pdf", "C:\nomfichier.pdf"
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 |
Partager