Select method of Range class failed

N

NoSoup4U

I have written a vbscript that kills the excel application after any
code that uses excel is complete. You can call it after your code is
finished. See Below.
'*******************************************************
Dim strComputer,objWMIService,colProcessList,objProcess
Kill_Excel
Sub Kill_Excel()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery ("Select * from
Win32_Process Where Name = 'Excel.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
End Sub
'*******************************************************



*** Sent via Developersdex http://www.developersdex.com ***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top