vba上传文件到ftp服务器,excel - 从Excel连接到FTP以自动执行文件共享(VBA初学者) - 堆栈内存溢出...

我是Excel VBA的初学者和新手,但我试图通过连接到Excel并可能创建一个有用的宏来自动化FTP(WinSCP)中的一些文件共享。 在FTP中我去了Session> Generate Session URL / code> Script(脚本文件),下面是代码:

open ftp://myUsername:myPassword@theHostname/

# Your command 1

# Your command 2

exit

open ftp://myUsername:myPassword@theHostname/

Option Explicit

Sub FtpTest()

MsgBox fnDownloadFile("ftp://yoursite", "username", "password", _

"The name of your file", _

"C:\The name of your file to save as")

End Sub

Function fnDownloadFile(ByVal strHostName As String, _

ByVal strUserName As String, _

ByVal strPassWord As String, _

ByVal strRemoteFileName As String, _

ByVal strLocalFileName As String) As String

'// Set a reference to: Microsoft Internet Transfer Control

'// This is the Msinet.ocx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值