Seeking VBA code to capture WinSCP Script Exit code when Shell function always returns 0

Advertisement

LeighWardle
Joined:
Posts:
6

Seeking VBA code to capture WinSCP Script Exit code when Shell function always returns 0

Hi everyone,

I am calling a WinSCP script from VBA code, invoking WinSCP from the Shell function.

In my testing, I had an example for which mkdir aborted.
For this case, the WinSCP log shows the Exit code: 1.
. 2024-06-03 17:11:04.982 Script: Failed
. 2024-06-03 17:11:04.982 Script: Exit code: 1
But Shell returned the error code = 0.

I want to make my code bullet-proof, so I am looking for code to capture the WinSCP Exit code?

Thanks, Leigh

Reply with quote E-mail

Advertisement

LeighWardle

Re: Seeking VBA code to capture WinSCP Script Exit code when Shell function always returns 0

Thanks, Martin; I mistakenly thought that VBA.Shell returned the Exit code, but now I understand it returns the Process ID.
Your suggestion, VBA Shell and Wait with Exit Code, solves my issue.

Reply with quote E-mail

Advertisement

You can post new topics in this forum