Bonjour à toutes et à tous,
Je cherche à envoyer un fichier fichier.csv via FTP dans un repertoire \XXX\
Après plusieurs recherches j'ai trouvé le code suivant :
Ce code ne fonctionne pas, pourriez-vous m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Public Sub SendFileViaFTP() Dim vPath As String Dim vFile As String Dim vFTPServ As String Dim fNum As Long vPath = ThisWorkbook.Path vFile = "Adresse fichier.csv" vFTPServ = "Adresse IP" à renseigner 'Mounting file command for ftp.exe fNum = FreeFile() Open vPath & "\FtpComm.txt" For Output As #fNum Print #1, "Login mdp" ' your login and password" Print #1, "dir\xxx\" 'change to dir on server Print #1, "bin" ' bin or ascii file type to send Print #1, "put " & vPath & "\" & vFile & " " & vFile ' upload local filename to server file Print #1, "close" ' Close connection Print #1, "quit" ' Quit FTP program Close Shell "ftp -n -i -g -s:" & vPath & "\FtpComm.txt " & vFTPServ, vbNormalNoFocus SetAttr vPath & "\FtpComm.txt", vbNormal Kill vPath & "\FtpComm.txt" End Sub
Merci d'avance,
Partager