Option Explicit
Private Declare Function InternetOpen Lib "wininet.dll" Alias _
"InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, _
ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal _
lFlags As Long) As Long
Private Declare Function InternetCloseHandle Lib "wininet.dll" _
(ByVal hInet As Long) As Integer
Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _
(ByVal hInternetSession As Long, ByVal sServerName As String, _
ByVal nServerPort As Integer, _
ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function FtpPutFile Lib "wininet.dll" Alias _
"FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, _
ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean
Sub Transfert_FTP()
Dim HwndConnect As Long
Dim lngINet As Long
lngINet = InternetOpen("Controle FTP", 1, vbNullString, vbNullString, 0)
'Connection ftp
HwndConnect = InternetConnect(lngINet, "[URL="ftp://ftp.provider.fr/"]ftp.Provider.fr[/URL]", 0, _
"MonProfil", "MotDePasse", 1, 0, 0)
'transfert et renomme le fichier
FtpPutFile HwndConnect, "C:\le classeur.xls", "ClasseurFTP.xls", &H0, 0
'Fermerture
InternetCloseHandle HwndConnect
End Sub