Using AppActivate and Sendkeys in VBA shell command

后端 未结 6 970
一个人的身影
一个人的身影 2021-01-05 16:30

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

6条回答
  •  北海茫月
    2021-01-05 16:51

    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.

提交回复
热议问题