我尝试打开命令提示符应用程序,然后让我的宏按两次输入,然后按F2。
Sub CMDSendKeys()
Dim program As Long
program = Shell("C:\379ER27\V01102\AFMDPI.exe", vbNormalFocus)
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Application.SendKeys ("~"), True
Application.SendKeys ("~"), True
Application.SendKeys ("{F2}"), True 'This doesn't work
End Sub
此代码将按两次输入,但不会按F2。
奇怪的是,如果我使用
,它会按回车键Application.SendKeys "~", True
但不如果我使用
Application.SendKeys "{ENTER}", True
有人知道如何将F2等功能键发送到命令提示符吗?