我有一个CSV文件。我点击csv文件上的按钮。我必须使用VB宏将该文件复制到unix服务器中。
没有线索。请提供任何样品。
此致
chaitu
答案 0 :(得分:2)
我为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"