Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim wsh As Object
- Dim waitOnReturn As Boolean
- Dim windowStyle As Integer
- Dim cstrSftp As String
- Dim strCommand As String
- Dim pUser As String
- Dim pPass As String
- Dim pHost As String
- Dim pFile As String
- Dim pRemotePath As String
- Dim site As String
- Dim resp As String
- Set wsh = VBA.CreateObject("WScript.Shell")
- 'Wait the execution to finish
- waitOnReturn = True
- 'Show the window
- windowStyle = 1
- 'Variables
- cstrSftp = """" & Application.ActiveWorkbook.Path & "pscp.exe" & """"
- site = "http://mysite/"
- pUser = "user"
- pPass = "password "
- pHost = "ftp.mysite"
- pRemotePath = "/home/"
- pFile = """" & Application.ActiveWorkbook.Path & "file.png" & """"
- 'Command string
- strCommand = "cmd /c echo n | " & cstrSftp & " -sftp -l " & pUser & " -pw " & pPass & " " & pFile & " " & pHost & ":" & pRemotePath
- 'Run the command
- wsh.Run strCommand, windowStyle, waitOnReturn
- strCommand = strCommand & " > " & """" "C:output.txt" & """"
Add Comment
Please, Sign In to add comment