Re : interdire la fermeture d'un userform
Re Philippe
J ai retrouvé le code que j avais mis sur un USF avec 1 texbox et 2commandbouton, un pour valider et un pour sortir.
Si ca peut t aider
Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then MsgBox ("Vous devez rentrer" & (Chr(10)) _
& "un mot de passe !!!"), vbInformation + vbOKOnly, _
"Message de Pierrot93": Exit Sub
If TextBox1.Value = "123456" Then
Unload Me
Else
MsgBox ("Mot de passe erroné !!!"), vbInformation + vbOKOnly, _
"Message de Pierrot93"
TextBox1.Value = ""
End If
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc(0) To Asc(9)
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = 1
End Sub
@+