For addnum=2 to 100
Window("计算器").WinButton("+").Click
Window("计算器").WinButton("text:="&addnum).Click
Next
Window("计算器").WinButton("=").Click
加到9的时候就运行不下去了,报错:
Cannot identify the object "[ WinButton ]" (of class WinButton). Verify that this object's properties match an object currently displayed in your application.
Dim addnum
Dim gw '个位
Dim sw '十位
Window("计算器").WinButton("1").Click
For addnum=2 to 100
Window("计算器").WinButton("+").Click
Select Case len(addnum)
Case 1
Window("计算器").WinButton("text:="&addnum).Click
Case 2
sw = Left(addnum,1)
gw = Right(addnum,1)
Window("计算器").WinButton("text:="&sw).Click
Window("计算器").WinButton("text:="&gw).Click
Case 3
Window("计算器").WinButton("1").Click
Window("计算器").WinButton("0").Click
Window("计算器").WinButton("0").Click
End Select
for i = 2 to 100
Window("计算器").Type i
Window("计算器").WinButton("+").Click
next
Window("计算器").WinButton("=").Click作者: sspku 时间: 2010-9-21 10:12
谢谢楼上的,代码小有错误啊,应该是:
Window("计算器").Type 1
for i = 2 to 100
Window("计算器").WinButton("+").Click
Window("计算器").Type i
next