1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Sub envoie_fichier()
'Vérifier la connection à internet
InternetOK = InternetOpen("ftp.franceserv.fr", 0, vbNullString, vbNullString, 0)
If InternetOK = 0 Then
MsgBox "connection internet impossible"
GoTo fin
End If
'Vérifier l'accès ftp
FtpOK = InternetConnect(InternetOK, "ftp.franceserv.com", 21, "identifiant", "motdepasse", 1, 0, 0)
'vérifier le dossier distant
Select_DossierDistant = FtpSetCurrentDirectory(FtpOK, "/projettutavocat.franceserv.com/documents/")
If Select_DossierDistant = 0 Then
MsgBox "impossible de trouver le répertoire distant "
GoTo fin
End If
'transfert du fichier
succès = FtpGetFile(FtpOK, " /projettutavocat.franceserv.com/documents/publi.csv", fichierlocal, True, 0, &H0, 0)
'fin affichage fenêtre d'attente
If succès Then
Result = "Le fichier a été correctement récupéré "
MsgBox Result |
Partager