我有一个 CSV 文件。单击 csv 文件上的按钮后。我必须使用 ftp 将该文件复制到使用 VB 宏的 unix 服务器中。
没有任何线索。请提供任何样品。
问候,
柴土
我为 FTP gif 文件编写了一些代码。您可以在以下位置查看所有代码
http://www.dailydoseofexcel.com/archives/2006/01/29/ftp-via-vba/
那里的内容比您需要的要多,但相关部分是:
'Create text file with ftp commands
Open sFname & ".txt" For Output As lFnumFtp
Print #lFnumFtp, "open " & sSITE 'open the site
Print #lFnumFtp, sUSER
Print #lFnumFtp, sPASS
Print #lFnumFtp, "binary" 'set file transfer mode
Print #lFnumFtp, "cd " & sDIR
For i = LBound(vFname) To UBound(vFname)
Print #lFnumFtp, "send " & Dir(vFname(i)) 'send files
Next i
Print #lFnumFtp, "bye" 'close ftp session
Close lFnumFtp 'close text file
lFnumBatch = FreeFile
'open a batch file
Open sFname & ".bat" For Output As lFnumBatch
Print #lFnumBatch, "ftp -s:" & sFname & ".txt"
Print #lFnumBatch, "Echo ""Complete""> " & sFname & ".out"
Close lFnumBatch
'run the batch file
Shell sFname & ".bat"