Guest User

Untitled

a guest
May 31st, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Dim wsh As Object
  2. Dim waitOnReturn As Boolean
  3. Dim windowStyle As Integer
  4. Dim cstrSftp As String
  5. Dim strCommand As String
  6. Dim pUser As String
  7. Dim pPass As String
  8. Dim pHost As String
  9. Dim pFile As String
  10. Dim pRemotePath As String
  11. Dim site As String
  12. Dim resp As String
  13.  
  14. Set wsh = VBA.CreateObject("WScript.Shell")
  15.  
  16. 'Wait the execution to finish
  17. waitOnReturn = True
  18.  
  19. 'Show the window
  20. windowStyle = 1
  21.  
  22. 'Variables
  23. cstrSftp = """" & Application.ActiveWorkbook.Path & "pscp.exe" & """"
  24. site = "http://mysite/"
  25. pUser = "user"
  26. pPass = "password "
  27. pHost = "ftp.mysite"
  28. pRemotePath = "/home/"
  29. pFile = """" & Application.ActiveWorkbook.Path & "file.png" & """"
  30.  
  31. 'Command string
  32. strCommand = "cmd /c echo n | " & cstrSftp & " -sftp -l " & pUser & " -pw " & pPass & " " & pFile & " " & pHost & ":" & pRemotePath
  33.  
  34. 'Run the command
  35. wsh.Run strCommand, windowStyle, waitOnReturn
  36.  
  37. strCommand = strCommand & " > " & """" "C:output.txt" & """"
Add Comment
Please, Sign In to add comment