I want to switch back and forth between application with the shell command in VBA. I am using SendKeys to do stuff in process A then move to process B, then to process A the
I know this question is old, but I have run into this same problem, but I don't think the answer that was chosen is the correct one.
When you call AppActivate, the script goes on halt, waiting for the target application to terminate. After the application is terminated, the script continues. I see no solution to this issue.
EDIT:
I use a batch-file to call CSCRIPT for the AppActivate command, and I notice you are strictly using a VBS file. Try calling CMD
as a new window and pass CSCRIPT //NoLogo //B WScript.CreateObject("WSCript.shell").AppActivate("Window Name")
as the argument, and see if that bypasses the issue.