XL 2019 Besoin d'aide "Erreur d'execution '424' : Objects requis"

YAP32

XLDnaute Occasionnel
Bonjour,

J'ai un classeur à l'ouverture qui demande login & mot de passe. Tous se passe bien sauf que j'ai voulus ajouter des text d'info dans les 2 TextBox.
Sauf que le dernier me donne une erreur "Erreur d'execution '424' : Objects requis" , pourriez vous m'aider svp!

Code ci-dessous avec image.

VB:
Private Sub CommandButton_fermer_Click()
Unload Me
End Sub

Private Sub CommandButton_entrer_Click()
    [_utilisateur] = "TextBox_Utilisateur"
    
    
    If TextBox_Utilisateur = "" Then Exit Sub
    If IsError([_motPasse]) Then
        Feuil13.Activate
        [_utilisateur] = "Invité"
        MsgBox "Utilisateur inconnu", vbExclamation + vbYesNo + vbDefaultButton1, "Information !!!"
    ElseIf TextBox_motPasse <> [_motPasse] Then
        Feuil13.Activate
        [_utilisateur] = "Invité"
        MsgBox "Mot de passe est incorrecte, vous restez en mode Invité", vbInformation, "Information !!!"
      
    End If
    
    Unload Me
    
End Sub

Private Sub Image1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub

Private Sub 123_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub

Private Sub Label1_Click()

End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub Label3_Click()

End Sub

Private Sub Label4_Click()

End Sub

Private Sub TextBox_motPasse_Change()

End Sub

Private Sub TextBox_Utilisateur_Change()

End Sub


Private Sub TextBox4_Change()

End Sub

Private Sub TextBox5_Change()

End Sub

Private Sub TextBox6_Change()
End Sub

Private Sub UserForm_Click()

End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode <> vbFormCode Then
    MsgBox "Veuillez fermer l'application avec le boutton quitter" & Chr(10) & "L'application va se fermer", vbOKOnly + vbExclamation, "Erreur"
    Cancel = True
    Application.DisplayAlerts = False
    Workbooks.Close
    Application.Quit
    Application.DisplayAlerts = True
    End If
End Sub
Private Sub UserForm_initialize()
    TextBox_Utilisateur.Value = "Entrer votre nom utilisateur"
    TextBox_motPasse.Value = "Entrer votre mot de passe"
End Sub
Private Sub TextBox_Utilisateur_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If TextBox_Utilisateur.Value = "Entrer votre nom utilisateur" Then TextBox_Utilisateur.Value = ""
    TextBox_Utilisateur.ForeColor = &H80&
    
End Sub
Private Sub TextBox_Utilisateur_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    TextBox_Utilisateur.Value = "Entrer votre nom utilisateure"
    TextBox_Utilisateur.ForeColor = &H80&
    TextBox_Utilisateur.Value = ""
End Sub

Private Sub TextBox_motPasse_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If TextBox_motPasse.Value = "Entrer votre mot de passe" Then TextBox_motPasse.Value = ""
    TextBox_motPasse.ForeColor = &H80&
    TextBox_motPasse.PasswordChar = "*"
    
End Sub
Private Sub TextBox_motPasse_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    TextBox_motPasse.Value = "Entrer votre mot de passe"
    TextBox_motPasse.ForeColor = &H80&
    TextBox_motPasse.PasswordChar = "*"
End Sub
 

Pièces jointes

  • Erreur.PNG
    Erreur.PNG
    34.8 KB · Affichages: 19
Solution
Bonjour.
Essayez Feuil13.[_utilisateur].Value ="TextBox_utilisateur" si "_utilisateur" est bien le nom donné à une cellule de cette feuille
Si c'est un nom qui doit juste valoir le texte: Feuil13.Names.Add "_utilisateur", "TextBox_utilisateur"

Dranreb

XLDnaute Barbatruc
Bonjour.
Essayez Feuil13.[_utilisateur].Value ="TextBox_utilisateur" si "_utilisateur" est bien le nom donné à une cellule de cette feuille
Si c'est un nom qui doit juste valoir le texte: Feuil13.Names.Add "_utilisateur", "TextBox_utilisateur"
 
Dernière édition:

Discussions similaires

Réponses
29
Affichages
920
Réponses
6
Affichages
196

Statistiques des forums

Discussions
312 207
Messages
2 086 247
Membres
103 163
dernier inscrit
Pelaez