懒码农。。。。。。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
Option Explicit
Dim objWMIService,colProcessList,strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'excel.exe'")
If colProcessList.Count>0 Then
MsgBox "检测到EXCEL程序运行中,程序退出!"
WScript.Quit
End If
Set colProcessList = Nothing
Set objWMIService = Nothing
WScript.Quit
posted on 2011-10-22 11:37  阿彬  阅读(544)  评论(0编辑  收藏  举报