Solved winscp

You have to quote the path to exe as it contains blanks!
Error would have shown if you tested your Shell Command with a Debug.Print
Code:
Dim shellCmd As String
shellCmd = strQuote & strSFTPDir & "winscp.exe" strQuote & " " & strQuote & strCommand & strQuote
Debug.Print shellCmd 'This output can be used for testing!
Call Shell(shellCmd , vbNormalNoFocus)

btw: why not use cURL, as it is buld in Windows?
I am getting syntax error in the line
shellCmd = strQuote & strSFTPDir & "winscp.exe" strQuote & " " & strQuote & strCommand & strQuote

This is my complete code
Code:
Dim strQuote As String
Dim shellCmd As String
Dim strCommand As String
Dim strSFTPDir As String

strQuote = Chr(34)
strSFTPDir = "c:\program files (x86)\winscp\"
strCommand = "/script=c:\dtcc.txt"     'change the file name/path specific to your computer
shellCmd = strQuote & strSFTPDir & "winscp.exe" strQuote & " " & strQuote & strCommand & strQuote
Debug.Print shellCmd 'This output can be used for testing!
Call Shell(shellCmd, vbNormalNoFocus)
 
I am getting syntax error in the line
shellCmd = strQuote & strSFTPDir & "winscp.exe" strQuote & " " & strQuote & strCommand & strQuote
There is an ampersand missing:

shellCmd = strQuote & strSFTPDir & "winscp.exe" & strQuote & " " & strQuote & strCommand & strQuote
 

Users who are viewing this thread

Back
Top Bottom