51Testing软件测试论坛

标题: Robot 为什么不支持for each .... next [打印本页]

作者: lwfwind    时间: 2006-8-2 20:33
标题: Robot 为什么不支持for each .... next
‘通过进程名终止进程

dim strComputer as string
dim objWMIService as object
dim colProcessList as object
dim objProcess as object
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next

编译时提示For语句错误,是不是Robot 2003不支持For each.......next?
该如何解决?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2