ShellExecuteEx in VBA
Ich verstehe die Verwendung von ShellExecute in VBA (für meine Outlook-Makros), möchte jedoch ShellExecuteEx verwenden, um auf das ausgeführte Programm in meinem Skript zu warten. Hat jemand ein Beispiel, wie man das macht? Derzeit habe ich diesen Code:
Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3
Public Declare Function ShellExecute _
Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
ByVal Hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long
'// Properties API
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
Hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Private Declare Function ShellExecuteEx _
Lib "shell32.dll" ( _
Prop As SHELLEXECUTEINFO) _
As Long
Public Function fnGetPropDlg(strFilepath As String) As Long
Dim Prop As SHELLEXECUTEINFO
With Prop
.cbSize = Len(Prop)
.fMask = &HC
.Hwnd = 0&
.lpVerb = "properties"
.lpFile = strFilepath
End With
fnGetPropDlg = ShellExecuteEx(Prop)
End Function
und dann mein Code, der das eigentliche Programm aufruft (mit ShellExecute):
RetVal = ShellExecute(0, "open", "C:\Documents and Settings\my\Desktop\zipTools.hta", "", "", SW_SHOWMAXIMIZED)
Kann mir jemand helfen, dies zu ändern, damit ich mit ShellExecuteEx auf das Schließen meiner HTA warten kann, bevor meine Skriptausführung fortgesetzt wird?