Open GoogleCodeExporter opened 9 years ago
VBA and VBS don't support Multithreading.
However, it's possible to perform automation simultaneously by executing
multiple VBS scripts asynchronously and wait for the end of each one.
An example which runs 2 scripts and waits for the end:
Set wsh = CreateObject("WScript.Shell")
Set queue = CreateObject("System.Collections.ArrayList")
queue.Add wsh.Exec("cscript //Nologo ""c:\scriptA.vbs""") 'execute script A
queue.Add wsh.Exec("cscript //Nologo ""c:\scriptB.vbs argument1 argument2""")
'execute script B with 2 arguments
'Waits for the end of each script
While queue.Count <> 0
For i = queue.Count - 1 To 0 Step -1
If queue(i).Status = 1 Then
If queue(i).ExitCode <> 0 Then WScript.Echo queue(i).StdErr.ReadAll
queue.RemoveAt i
End If
Next
WScript.Sleep 200
Wend
Original comment by florentbr
on 14 Apr 2014 at 12:54
Original comment by florentbr
on 8 Sep 2014 at 5:40
Original issue reported on code.google.com by
shan4sha...@gmail.com
on 12 Apr 2014 at 8:33