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

Faire clignoter un textbox si :

5 réponses
Avatar
Florian
Bonsoir
j'essai à partir de l'exemple ci-dessous d'ajouter un clignotement dans le
textbox,
afin que si l'utilisateur n'a rien saisie, après le msgbox, le textbox
clignote:
J'ai une procédure qui me fait clignoter une cellule, mais je ne sais pas du
tout comment l'adapter ;-)
Merci pour votre aide
Flo riant

'Nom
If TextBox2 = "" Then
MsgBox "Vous devez saisir un nom," & vbNewLine & _
"sinon vous ne pouvez pas valider la saisie.", vbExclamation, _
" Nom ?"
TextBox2.SetFocus
Exit Sub
End If

'Clignotement de cellule
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Clignote_cell()
ActiveSheet.Unprotect Password:="toto"
Dim i As Byte
For i = 1 To 6
Sleep 100
With ActiveCell.Interior
.ColorIndex = 2
End With
Sleep 100
With ActiveCell.Interior
.ColorIndex = 4
End With
Next i
ActiveCell.Interior.ColorIndex = 0
ActiveSheet.Protect Password:="toto"
End Sub

5 réponses

Avatar
garnote
Salut Florian

Une piste :

For i = 1 To 500
TextBox1.Visible = False
DoEvents
TextBox1.Visible = True
DoEvents
Next i

Serge

"Florian" a écrit dans le message de news:
uf%23S%
Bonsoir
j'essai à partir de l'exemple ci-dessous d'ajouter un clignotement dans le
textbox,
afin que si l'utilisateur n'a rien saisie, après le msgbox, le textbox
clignote:
J'ai une procédure qui me fait clignoter une cellule, mais je ne sais pas
du tout comment l'adapter ;-)
Merci pour votre aide
Flo riant

'Nom
If TextBox2 = "" Then
MsgBox "Vous devez saisir un nom," & vbNewLine & _
"sinon vous ne pouvez pas valider la saisie.", vbExclamation, _
" Nom ?"
TextBox2.SetFocus
Exit Sub
End If

'Clignotement de cellule
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Clignote_cell()
ActiveSheet.Unprotect Password:="toto"
Dim i As Byte
For i = 1 To 6
Sleep 100
With ActiveCell.Interior
.ColorIndex = 2
End With
Sleep 100
With ActiveCell.Interior
.ColorIndex = 4
End With
Next i
ActiveCell.Interior.ColorIndex = 0
ActiveSheet.Protect Password:="toto"
End Sub




Avatar
Florian
Bonjour Garnote et merci
content de te re lire ;-)
Cela va tellement vite, que l'on ne voit rien ;-)
Flo riant

"garnote" a écrit dans le message de news:
%23Ew$
Salut Florian

Une piste :

For i = 1 To 500
TextBox1.Visible = False
DoEvents
TextBox1.Visible = True
DoEvents
Next i

Serge

"Florian" a écrit dans le message de news:
uf%23S%
Bonsoir
j'essai à partir de l'exemple ci-dessous d'ajouter un clignotement dans
le textbox,
afin que si l'utilisateur n'a rien saisie, après le msgbox, le textbox
clignote:
J'ai une procédure qui me fait clignoter une cellule, mais je ne sais pas
du tout comment l'adapter ;-)
Merci pour votre aide
Flo riant

'Nom
If TextBox2 = "" Then
MsgBox "Vous devez saisir un nom," & vbNewLine & _
"sinon vous ne pouvez pas valider la saisie.", vbExclamation, _
" Nom ?"
TextBox2.SetFocus
Exit Sub
End If

'Clignotement de cellule
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Clignote_cell()
ActiveSheet.Unprotect Password:="toto"
Dim i As Byte
For i = 1 To 6
Sleep 100
With ActiveCell.Interior
.ColorIndex = 2
End With
Sleep 100
With ActiveCell.Interior
.ColorIndex = 4
End With
Next i
ActiveCell.Interior.ColorIndex = 0
ActiveSheet.Protect Password:="toto"
End Sub








Avatar
garnote
Tu pourrais peut-être ajouter un dodo!

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
For i = 1 To 500
TextBox1.Visible = False
Sleep(50)
DoEvents
TextBox1.Visible = True
DoEvents
Sleep(50)
Next i

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

Bonjour Garnote et merci
content de te re lire ;-)
Cela va tellement vite, que l'on ne voit rien ;-)
Flo riant

"garnote" a écrit dans le message de news:
%23Ew$
Salut Florian

Une piste :

For i = 1 To 500
TextBox1.Visible = False
DoEvents
TextBox1.Visible = True
DoEvents
Next i

Serge

"Florian" a écrit dans le message de news:
uf%23S%
Bonsoir
j'essai à partir de l'exemple ci-dessous d'ajouter un clignotement dans
le textbox,
afin que si l'utilisateur n'a rien saisie, après le msgbox, le textbox
clignote:
J'ai une procédure qui me fait clignoter une cellule, mais je ne sais
pas du tout comment l'adapter ;-)
Merci pour votre aide
Flo riant

'Nom
If TextBox2 = "" Then
MsgBox "Vous devez saisir un nom," & vbNewLine & _
"sinon vous ne pouvez pas valider la saisie.", vbExclamation, _
" Nom ?"
TextBox2.SetFocus
Exit Sub
End If

'Clignotement de cellule
Sub Clignote_cell()
ActiveSheet.Unprotect Password:="toto"



Dim i As Byte
For i = 1 To 6
Sleep 100
With ActiveCell.Interior
.ColorIndex = 2
End With
Sleep 100
With ActiveCell.Interior
.ColorIndex = 4
End With
Next i
ActiveCell.Interior.ColorIndex = 0
ActiveSheet.Protect Password:="toto"
End Sub















Avatar
Hervé
Bonsoir Florian
Teste le code ci-dessous (à mettre dans le module de ta Form). Pour le test,
tu clique sur la Form :
Private Declare Function GetTickCount Lib "Kernel32" () As Long

Sub Minuterie(Milliseconde As Long)
Dim Arret As Long
Arret = GetTickCount() + Milliseconde
Do While GetTickCount() < Arret
DoEvents
Loop
End Sub

Sub Clignote()
Dim I As Integer
Do While I < 10
TextBox1.BackColor = &HFF&
Minuterie 500
TextBox1.BackColor = &H80000005
Minuterie 500
I = I + 1
Loop
End Sub

Private Sub UserForm_Click()
Clignote
End Sub

Hervé.

"Florian" a écrit dans le message news:
uf#S#
Bonsoir
j'essai à partir de l'exemple ci-dessous d'ajouter un clignotement dans le
textbox,
afin que si l'utilisateur n'a rien saisie, après le msgbox, le textbox
clignote:
J'ai une procédure qui me fait clignoter une cellule, mais je ne sais pas
du

tout comment l'adapter ;-)
Merci pour votre aide
Flo riant

'Nom
If TextBox2 = "" Then
MsgBox "Vous devez saisir un nom," & vbNewLine & _
"sinon vous ne pouvez pas valider la saisie.", vbExclamation, _
" Nom ?"
TextBox2.SetFocus
Exit Sub
End If

'Clignotement de cellule
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Clignote_cell()
ActiveSheet.Unprotect Password:="toto"
Dim i As Byte
For i = 1 To 6
Sleep 100
With ActiveCell.Interior
.ColorIndex = 2
End With
Sleep 100
With ActiveCell.Interior
.ColorIndex = 4
End With
Next i
ActiveCell.Interior.ColorIndex = 0
ActiveSheet.Protect Password:="toto"
End Sub




Avatar
Florian
Bonsoir et désolé, je dois rapidement m'absenter ;-(
Je teste donc demain et vous tiens au courant..
Bonne soirée
Flo riant

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

Bonsoir Florian
Teste le code ci-dessous (à mettre dans le module de ta Form). Pour le
test,
tu clique sur la Form :
Private Declare Function GetTickCount Lib "Kernel32" () As Long

Sub Minuterie(Milliseconde As Long)
Dim Arret As Long
Arret = GetTickCount() + Milliseconde
Do While GetTickCount() < Arret
DoEvents
Loop
End Sub

Sub Clignote()
Dim I As Integer
Do While I < 10
TextBox1.BackColor = &HFF&
Minuterie 500
TextBox1.BackColor = &H80000005
Minuterie 500
I = I + 1
Loop
End Sub

Private Sub UserForm_Click()
Clignote
End Sub

Hervé.

"Florian" a écrit dans le message news:
uf#S#
Bonsoir
j'essai à partir de l'exemple ci-dessous d'ajouter un clignotement dans
le
textbox,
afin que si l'utilisateur n'a rien saisie, après le msgbox, le textbox
clignote:
J'ai une procédure qui me fait clignoter une cellule, mais je ne sais pas
du

tout comment l'adapter ;-)
Merci pour votre aide
Flo riant

'Nom
If TextBox2 = "" Then
MsgBox "Vous devez saisir un nom," & vbNewLine & _
"sinon vous ne pouvez pas valider la saisie.", vbExclamation, _
" Nom ?"
TextBox2.SetFocus
Exit Sub
End If

'Clignotement de cellule
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Clignote_cell()
ActiveSheet.Unprotect Password:="toto"
Dim i As Byte
For i = 1 To 6
Sleep 100
With ActiveCell.Interior
.ColorIndex = 2
End With
Sleep 100
With ActiveCell.Interior
.ColorIndex = 4
End With
Next i
ActiveCell.Interior.ColorIndex = 0
ActiveSheet.Protect Password:="toto"
End Sub