Option Explicit Private Declare Function OpenProcess Lib "Kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long Private Const SYNCHRONIZE = &H100000 Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Const INFINITE = &HFFFF Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Public Sub ShellAndWait(ByVal ProgramName As String, ByVal WindowStyle As VbAppWinStyle) Dim pid As Long Dim hProcess As Long 'si une erreur surviens lors de l'appel du programme On Error GoTo GestErrors 'on demarre le programme, en recuperant l'identifiant pid = Shell(ProgramName, WindowStyle) On Error GoTo 0 'on recupere le handle du process, par rapport au pid hProcess = OpenProcess(SYNCHRONIZE, 0, pid) 'SYNCHRONIZE permet dindiquer qu'on attends la fermeture If hProcess <> 0 Then ' si on a bien recupere le handle 'on attends Call WaitForSingleObject(hProcess, INFINITE) 'on pourrait mettre un TimeOut...... Call CloseHandle(hProcess) 'on libere le handle End If Exit Sub GestErrors: Call MsgBox("Erreur de démarrage du programme :" & vbCrLf & ProgramName & vbCrLf & Err.Description, vbOKOnly Or vbCritical, "Erreur") End Sub