How can I kill task manager processes through VBA code?

后端 未结 4 1684
太阳男子
太阳男子 2020-11-29 11:57

I\'m trying to kill certain processes through VBA. I have a proprietary object that connects to a market data bus. Through RTD I call this object to pub/sub to the bus. Howe

4条回答
  •  臣服心动
    2020-11-29 12:21

    Take a look at one more example:

    Sub Test()
        If TaskKill("notepad.exe") = 0 Then MsgBox "Terminated" Else MsgBox "Failed"
    End Sub
    
    Function TaskKill(sTaskName)
        TaskKill = CreateObject("WScript.Shell").Run("taskkill /f /im " & sTaskName, 0, True)
    End Function
    

提交回复
热议问题