1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| "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 i As Integer
Const strUrl As String = "monstringurlcheminversleifichier"
Dim strSavePath As String
Dim returnValue As Long
strSavePath = Application.Path & "\xxxxxxxx.txt"
returnValue = URLDownloadToFile(0, strUrl, strSavePath, 0, 0)
If returnValue = 0 Then
MsgBox "Fichier téléchargé :" & vbNewLine & strSavePath, vbInformation, "Réussite"
Else
MsgBox "Erreur lors du téléchargement " & returnValue, vbExclamation, "Echec"
End If
End Sub |
Partager