通过 FTP 从 Excel VBA 上传文件 [英] Upload file via FTP from Excel VBA
问题描述
需要从 Excel VBA 将文件 (file.txt) 上传到服务器 (ftp.server.com).(不一定是 FTP,只需要能够将文件放在那里并取回,我在 GoDaddy 共享主机上有一个服务器)
Need to upload a file (file.txt) to a server (ftp.server.com) from Excel VBA. (does not have to be necessarily FTP, just need to be able to put the file there and get it back, and I've got a server on GoDaddy shared hosting)
我尝试的是运行这个脚本:
What I tried was to run this script:
ftp -s:script.txt
script.txt:
script.txt:
open ftp.server.com
USER
PASS
lcd c:
put file.txt
disconnect
bye
我得到的错误是:
425 无法打开到端口 53637 的数据连接:连接超时
425 Could not open data connection to port 53637: Connection timed out
Google 告诉我需要进入被动模式,但命令行 ftp.exe
客户端不允许这样做.
Google tells me I need to go to passive mode, but the command-line ftp.exe
client doesn't allow that.
我有比 FTP 更简单的替代方法,还是有更好的方法通过 VBA 上传文件(无需命令行解决方法)?
Do I have an easier alternative to FTP, or is there a better way to upload a file via VBA (without the command-line workaround)?
我正在考虑使用 DROPBOX(但我真的不想在所有需要该程序的工作站上安装该程序).
I'm thinking about using DROPBOX (but I really don't want to have to install this program on all the workstations that will need the program).
推荐答案
http://winscp.net 是免费的,可编写脚本,支持被动模式,绝对是优秀的.
http://winscp.net is free, scriptable, supports passive mode and is definitely EXCELLENT.
这篇关于通过 FTP 从 Excel VBA 上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!