我有一个Appactivate VBA脚本可以打开一个程序,然后发送密钥进行登录。它运行了好几年,而且自从程序得到更新以来,它似乎不再起作用。问题是appactivate实际上将窗口向上拉,但是它不发送任何键。在我实际上用鼠标单击窗口之前,密码部分不会显示闪烁的光标。他们是激活窗口/程序的另一种方法吗?代码如下。
Sub LOGIN()
Shell ("C:\ASD\ASDF.exe")
Dim PASS As String
PASS = Range("D11")
AppActivate ("ASDF")
'THIS IS WHERE IT STOPS. THE WINDOW POPS UP. THE CODE DOES NOT ERROR ITS JUST DOESN'T SEND ANY KEYS AFTER THIS BECAUSE I THINK THE WINDOW IS TRULY NOT ACTIVE.
Application.SendKeys "+{TAB 4}"
Application.SendKeys "FACILITY NAME"
Application.Wait (Now + TimeSerial(0, 0, 1))
Application.SendKeys "{TAB 4}"
Application.SendKeys PASS
Application.SendKeys vbCrLf
End Sub