Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Sub ShellWait(sCommandLine As String) '等到外部程序执行完成
Dim hShell As Long, hProc As Long, lExit As Long
hShell = Shell(sCommandLine, vbHide)
hProc = OpenProcess(&H400, False, hShell)
Do
GetExitCodeProcess hProc, lExit
DoEvents
Loop While lExit = &H103
End Sub