Option Explicit
Private Sub Form_Load()
Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' 运行计算器
AppActivate ReturnValue ' 激活计算器
For I = 1 To 100 ' 设置计数循环
SendKeys I & "{+}", True ' 按下按键给计算器
Next I ' 将所有 I 值相加
SendKeys "=", True ' 取得总和
SendKeys "%{F4}", True ' 按 ALT+F4 关闭计算器
End Sub
Private Sub Form_Load()
Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' 运行计算器
AppActivate ReturnValue ' 激活计算器
For I = 1 To 100 ' 设置计数循环
SendKeys I & "{+}", True ' 按下按键给计算器
Next I ' 将所有 I 值相加
SendKeys "=", True ' 取得总和
SendKeys "%{F4}", True ' 按 ALT+F4 关闭计算器
End Sub