我一直在尝试使用以下代码
自动将文件从服务器复制到我的本地 Sub SftpGet()
Const cstrSftp As String = """C:\Program Files\PuTTY\pscp.exe"""
Dim strCommand As String
Dim pUser As String
Dim pPass As String
Dim pHost As String
Dim pFile As String
Dim pRemotePath As String
pUser = "USER" '//User on remote system
pPass = "PASSWORD" '//User's password on remote system
pHost = "SFTP.WEBSITE.ORG" '//Ip address of remote system
pFile = "C:\Important_Info_Copy.txt" '//File to write copy of "pRemotePath" to
pRemotePath = "/Important_Info.txt" '//Location of file to copy
strCommand = cstrSftp & " -sftp -l " & pUser & " -pw " & pPass &" " & pHost & ":" & pRemotePath &_
" " & pFile
Debug.Print strCommand
Shell strCommand, 1 ' vbNormalFocus '
End Sub
然而,代码似乎在不复制任何文件的情况下运行。请帮忙