Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 167
- Office Version
- 2010
- Platform
- Windows
Hi everyone, I'm from Vietnam, so I use Google Translate, so the words may be difficult to understand, hope everyone understands. I need a code to open a program name (because the path often changes), so I can't get the path but have to get the program name
Currently I am using this code but this code is only Off, if you want to change it to On, then edit it somewhere. Sincerely thank!
Currently I am using this code but this code is only Off, if you want to change it to On, then edit it somewhere. Sincerely thank!
Code:
Function TaskKill(sTaskName)
TaskKill = CreateObject("WScript.Shell").Run("taskkill /f /im " & sTaskName, 0, True)
End Function
Sub turnoffthe program()
On Error Resume Next
TaskKill ("Notepad.exe")
End Sub