Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Contrôle textbox

2 réponses
Avatar
Joël André
Bonsoir,

En excel 2000, j'ai réalisé un userform comportant plusieurs textbox.
Pour celle indiquée ci-dessous, le contrôle change fonctionne bien.
Si l'entrée comporte moins de 10 caractères, j'ai tenté le contrôle
afterupdate pour faire revenir le pointeur dans la box même et corriger,
mais cela ne marche pas.
Auriez-vous une solution?

Merci.

Joël

Private Sub StagiaireTéléphoneFixe_Change()
If StagiaireTéléphoneFixe.Value > "" And Not _
IsNumeric(StagiaireTéléphoneFixe.Value) Then
Beep
StagiaireTéléphoneFixe.Text = Left(StagiaireTéléphoneFixe.Text,
_
Len(StagiaireTéléphoneFixe.Text) - 1)
End If
End Sub
Private Sub StagiaireTéléphoneFixe_AfterUpdate()
If Len(StagiaireTéléphoneFixe.Text) < 10 Then
Beep
StagiaireTéléphoneFixe.SetFocus
'????????
End If
End Sub

2 réponses

Avatar
JB
Bonsoir,

Private Sub TextBox1_BeforeUpdate(ByVal Cancel As
MSForms.ReturnBoolean)
If Len(StagiaireTéléphoneFixe.Text) < 10 Then
Beep
Cancel = True
End If
End Sub

JB
http://boisgontierjacques.free.fr/


On 30 nov, 19:25, "Joël André" wrote:
Bonsoir,

En excel 2000, j'ai réalisé un userform comportant plusieurs textbox.
Pour celle indiquée ci-dessous, le contrôle change fonctionne bien.
Si l'entrée comporte moins de 10 caractères, j'ai tenté le contrô le
afterupdate pour faire revenir le pointeur dans la box même et corriger ,
mais cela ne marche pas.
Auriez-vous une solution?

Merci.

Joël

Private Sub StagiaireTéléphoneFixe_Change()
        If StagiaireTéléphoneFixe.Value > "" And Not _
                    IsNumeric(StagiaireTéléphoneF ixe.Value) Then
            Beep
            StagiaireTéléphoneFixe.Text = Left(Stagiair eTéléphoneFixe.Text,
_
                    Len(StagiaireTéléphoneFixe.Te xt) - 1)
        End If
    End Sub
Private Sub StagiaireTéléphoneFixe_AfterUpdate()
        If Len(StagiaireTéléphoneFixe.Text) < 10 Then
            Beep
            StagiaireTéléphoneFixe.SetFocus
            '????????
        End If
    End Sub


Avatar
Joël André
Merci JB, votre routine fonctionne à merveille.

Merci

Joël

"JB" a écrit dans le message de news:

Bonsoir,

Private Sub TextBox1_BeforeUpdate(ByVal Cancel As
MSForms.ReturnBoolean)
If Len(StagiaireTéléphoneFixe.Text) < 10 Then
Beep
Cancel = True
End If
End Sub

JB
http://boisgontierjacques.free.fr/


On 30 nov, 19:25, "Joël André" wrote:
Bonsoir,

En excel 2000, j'ai réalisé un userform comportant plusieurs textbox.
Pour celle indiquée ci-dessous, le contrôle change fonctionne bien.
Si l'entrée comporte moins de 10 caractères, j'ai tenté le contrôle
afterupdate pour faire revenir le pointeur dans la box même et corriger,
mais cela ne marche pas.
Auriez-vous une solution?

Merci.

Joël

Private Sub StagiaireTéléphoneFixe_Change()
If StagiaireTéléphoneFixe.Value > "" And Not _
IsNumeric(StagiaireTéléphoneFixe.Value) Then
Beep
StagiaireTéléphoneFixe.Text = Left(StagiaireTéléphoneFixe.Text,
_
Len(StagiaireTéléphoneFixe.Text) - 1)
End If
End Sub
Private Sub StagiaireTéléphoneFixe_AfterUpdate()
If Len(StagiaireTéléphoneFixe.Text) < 10 Then
Beep
StagiaireTéléphoneFixe.SetFocus
'????????
End If
End Sub