ich möchte per VBA ein externes Programm schliessen.
Das Programm heisst übertragungcom1.exe.
Könnte mir da jemand helfen.
Vielen Dank im voraus.
Georg
Sub KillIt()
Shell "Notepad.exe", 1
Shell "c:\DeinProgUti\pskill.exe notepad.exe"
End Sub
Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Declare
Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Declare
Function TerminateProcess Lib "kernel32" _
(ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Const PROCESS_TERMINATE = &H1
Sub KillIt_2()
Dim iTask As Long, pHandle As Long
iTask = Shell("Notepad.exe", 1)
pHandle = OpenProcess(PROCESS_TERMINATE, False, iTask)
TerminateProcess pHandle, 0
CloseHandle pHandle
End Sub