我在Excel中编写了一个脚本来调用VC程序。我想在运行后将焦点保持在 Excel 中。
...
strPath = "xxx.exe"
X = Shell(strPath, vbNormalNoFocus)
...
但运行后的 VC 程序仍然关注重点。外壳命令的参数 vbNormalNoFocus 不起作用。我怎样才能把注意力集中在EXECL上?
我不想使用application.Wait(now + TimeValue ("0:00:05") VBA.AppActivate "11.xlsx"
.
下面是对 shell 函数的描述。
使用 AppActivate 语句
...
strPath = "xxx.exe"
X = Shell(strPath, vbNormalFocus)
AppActivate X ' Will set the focus on xxx.exe
AppActivate "Microsoft Excel" ' Will set the focus on Excel
...