- 16
- 0
- 约1.48万字
- 约 22页
- 2017-06-05 发布于河南
- 举报
vbSendKeys方法(国外英文资料)
vbSendKeys方法
This example USES a Shell function to run the calculator program attached to Microsoft Windows. Then use the SendKeys statement to press certain numeric keys of the calculator and exit the calculator. (to observe the sample running process, the sample can be affixed to the process, operation process again can. Because AppActivate will focus shifted to the calculator application, so this sample not to run in a single step.)
Dim ReturnValue, i.
ReturnValue = Shell ( calc.exe , 1) runs the calculator.
AppActivate ReturnValue activates the calculator.
For I = 1 To 100 sets the counting loop.
The SendKeys I {+}, True presses the button to give the calculator
So Next I prime will add up all the I values.
The SendKeys =, True makes the sum
The SendKeys % {F4}, True pressed ALT + F4 to close the calculator.
SendKeys method
Please refer to the
WshShell object | Run method
Send one or more keys to the active window (as if they were keystrokes on the keyboard).
Object. The SendKeys (string)
parameter
The object
WshShell object.
The string
Represents the string value of the key hit (one or more) to be sent.
instructions
Using the SendKeys method, the key can be sent to an application that has no automatic interface. Most keyboard characters can be used as a keystroke. Some keyboard characters are composed of multiple keystrokes (for example, CTRL + SHIFT + HOME). To send a single keyboard character, send the character itself as a string parameter. For example, to send the letter x, send the string parameter x.
Notice that to send a space, send a string.
You can use SendKeys to send multiple keystrokes simultaneously. To do this, you can place each key in the order in order to create a compound string parameter that represents a series of keystrokes. For example, to send a key hit a, b, and c, you need to send the string parameter ABC. The SendKeys method USES some characters as a characters modifier (rather than its own meaning). This particular set of characters
原创力文档

文档评论(0)