AW: Outlook minimiert starten
23.07.2011 18:46:23
Tino
Hallo,
versuche es mal so.
Private Declare Function OpenProcess Lib "kernel32.dll" ( _
ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32.dll" ( _
ByVal hProcess As Long, _
ByVal uExitCode As Long) As Long
Private Const PROCESS_TERMINATE = &H1
Private Const PROCESS_VM_READ = &H10
Private lvntTaskId As Variant
Public Sub Open_Outlook()
Dim strPath$
strPath = Application.Parent.Path
If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"
lvntTaskId = Shell(strPath & "OUTLOOK.EXE", vbMinimizedFocus)
End Sub
Public Sub Close_Outlook()
Dim lngHandle As Long
If lvntTaskId <> 0 Then
lngHandle = OpenProcess(PROCESS_VM_READ Or PROCESS_TERMINATE, 0&, lvntTaskId)
If lngHandle <> 0 Then Call TerminateProcess(lngHandle, 0&)
End If
End Sub
Gruß Tino