1

I have an excel VBA script to take a file and upload it to my FTP site. What I would like to do is add a -speed switch to the command to limit the transfer speed to something like 700k. I have the following code now that works great, just doesn't limit:

Call Shell( _
"C:\1a7j42w\WinSCP\WinSCP.com /log=C:\1a7j42w\WinSCP\excel.log /command " & _
"""open ftp://xxxxxxx:[email protected]/"" " & _
"""put """"" & RealFile & """"""" " & _
"""exit""")

And I know from the WinSCP page here (https://winscp.net/eng/docs/scriptcommand_put) that I need to add a -speed=<700> after the put command, but I'm confused by all the quotes, and placement of this speed switch. I tried adding it after the put command so it was like this:

"""put -speed=<700>""""" & RealFile & """"""" " & _

but that did not work. I also tried adding another space after the close bracket behind 700 and in front of the quotes, but that did not work either.

I'm sure I'm just not placing it in the correct location or doing the quotes/spaces right, but I'm not sure where to go from here. Any help would be greatly appreciated.

3
  • Your put command looks like this in the shell command if I try your code: "put ""RealFileContents""" - seems like a strange amount of quotes? Maybe you could try single quotes instead, and just use one on either side of the file name? Commented Jan 15, 2016 at 15:34
  • The amount of quotes, and direct syntax came from this post (stackoverflow.com/a/33687368/4946876) by Martin Prikryl (stackoverflow.com/users/850848/martin-prikryl) - and it works very well, he describes in that post why the amount of quotes. -- I just don't know where in there to add the switch. Commented Jan 15, 2016 at 15:55
  • OK, forget my comment! :) Commented Jan 15, 2016 at 16:06

1 Answer 1

1

It's not -speed=<700>, but -speed=700. Also, you miss a space after the switch.

So the correct code is:

"""put -speed=700 """"" & RealFile & """"""" " & _

Reference: https://winscp.net/eng/docs/scriptcommand_put

Sign up to request clarification or add additional context in comments.

1 Comment

Got it. Tried it and it worked! Thank you again for the help. So my second try would have worked had I not used the brackets. That's good to know for other switches. Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.