Using AppActivate and Sendkeys in VBA shell command

后端 未结 6 974
一个人的身影
一个人的身影 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:46

    Similarly, I was trying to use AppActivate on a pdf document I had opened with a shell command so that I could use SendKeys on it. It would always generate Run Time Error '5'. My solution, eventually was to NOT use AppActivate at all, in fact opening the document brings it to the forefront anyway. The problem is that the SendKeys statement executes immediately after the shell command but the pdf needs a second or two to open up. My solution is to pause the code for a couple seconds before excuting the sendkeys statement.

    I used a time delay curtosy of pootle flump. Check out the thread here: http://www.dbforums.com/microsoft-access/1219379-time-delay-vba.html

提交回复
热议问题