Option Explicit
Private MotPasse As String, OK As Boolean
Public Function MotDePasseOK(ByVal Nom As String, ByVal MP As String) As Boolean
Me.Caption = Nom
MotPasse = MP
Me.Show
MotDePasseOK = OK
End Function
Private Sub CommandButton1_Click()
Me.Hide
OK = TextBox1.Value = MotPasse
If OK Then
MsgBox "Accès autorisé!", vbInformation, Me.Caption
Else
MsgBox "Accès refusé!", vbExclamation, Me.Caption
End If
End Sub