VBA Kill Task

VBA to kill task in task manager by process name.  You need to lookup the process name in task manager so you can tell excel which task to kill.  In the below example Excel is killing task Max.exe process.


Function TaskKill(sTaskName)
TaskKill = CreateObject("WScript.Shell").Run("taskkill /f /im " & sTaskName, 0, True)
End Function
TaskKill "Max.exe"