I looked up some code to terminate a process using VBA and it loops through processes and finds what I'm looking for, however the terminate command is "Not Found".
Can anybody clarify what's wrong with the code? Do I need a reference library activated?
Code:Public Function test1()Dim cProc As Variant, oProc As Object Set cProc = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("Select * From Win32_Process", , 48) For Each oProc In cProc If oProc.name = "iexplore.exe" Then oProc.Terminate Next Set oServ = Nothing Set cProc = Nothing End Function