[COLOR="Blue"]'### L'affectation au variant MesTitres ###
'### sera à adapter plus bas ###
Dim MesTitres As Variant
Dim OnTimer&
Private Declare Function SendMessage& Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Private Declare Function FindWindow& Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String)
Private Declare Function SetTimer& Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Private Declare Function KillTimer& Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, _
ByVal cch As Long)
'___________________________
Private Sub CloseMsgBox()
Dim HwndMsgBox&
Dim i&
Dim Ch$
Dim Tampon&
Dim reponse&
For i& = LBound(MesTitres) To UBound(MesTitres)
HwndMsgBox& = FindWindow(vbNullString, MesTitres(i&))
If HwndMsgBox& > 0 Then Exit For
Next i&
If HwndMsgBox& > 0 Then
Ch$ = Space(1024)
Tampon& = Len(Ch$)
reponse& = GetWindowText(HwndMsgBox&, Ch$, Tampon&)
Ch$ = Trim(Replace(Ch$, Chr$(0), ""))
SendMessage HwndMsgBox&, &H10, 0, ByVal 0&
End If
End Sub
'___________________________
Private Sub RunTimer(Delai&)
If OnTimer& > 0 Then OffTimer
OnTimer& = SetTimer(0, 0, ByVal Delai&, AddressOf CloseMsgBox)
End Sub
'___________________________
Private Sub OffTimer()
If OnTimer& > 0 Then
OnTimer& = KillTimer(0&, OnTimer&)
OnTimer& = 0
End If
End Sub[/COLOR]
[COLOR="Red"] '############################################
'### CE QUI SUIT EST VOTRE CODE A ADAPTER ###
'############################################
'___________________________
Sub maMacro()
'*** Code traitement avant appel au solveur ***
'///// à ajouter à votre code ////
OnTimer& = 0
Call RunTimer(Delai:=0)
'### Mettre les titres des MsgBox à ###
'### cacher dans le Array du Variant ###
'### MesTitres. Cette instruction peut ###
'### être placée en tête de la procédure ###
'### maMacro MAIS avant l'usage du solveur ###
MesTitres = Array("Résultat du solveur", "un autre", "etc")
'---- Ici la boucle où le solveur s'exécute ----
'for truc= 1 To 10
'Utilisation du solveur
'Next truc
'---- Fin de la boucle ----
Call OffTimer
'/////////////////////////////////
'*** Code traitement après appel au solveur ***
End Sub[/COLOR]