Option Explicit
Dim Ctrl As MSForms.Control, ÇaRoule As Boolean
Private Sub UserForm_Activate()
ÇaRoule = True
Do While ÇaRoule
DoEvents
If Not Ctrl Is Me.ActiveControl Then
Colorer vbWhite
Set Ctrl = Me.ActiveControl
Colorer vbRed
End If
Loop
End Sub
Private Sub Colorer(Couleur As Long)
If Ctrl Is Nothing Then Exit Sub
If TypeName(Ctrl) <> "ComboBox" And _
TypeName(Ctrl) <> "TextBox" Then Exit Sub
Ctrl.Object.BackColor = Couleur
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ÇaRoule = False
End Sub