Dim mydate As Object Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If InStr("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ", Chr(KeyAscii)) 0 Then KeyAscii 0 End Sub Private Sub ClipClear() Set MyData = New DataObject MyData.SetText "Interdiction de copier/coller!" MyData.PutInClipboard End Sub Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) ClipClear End Sub Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ClipClear End Sub Private Sub TextBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ClipClear End Sub Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) ClipClear End Sub
Je te laisse faire, acive. Vas-y (facile)
Private Sub TextBox1_Change() Dim toto Static anc As String toto = Array("*[" & Chr(1) & "-/]*", "*[:-@]*", "*[([)\-" & Chr(255) & "]*") For i = 0 To UBound(toto) If TextBox1.Text Like toto(i) Then TextBox1.Text = anc: Exit Sub End If Next anc = TextBox1.Text End Sub Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) 'ceci n'est là que pour rendre la vie facile à l'utilisateur 'on peut le supprimer, mais on force alors l'utilisateur à presser la touche Maj pour rien KeyAscii = Asc(UCase(Chr(KeyAscii))) End Sub
Private Sub Text1_Change() Text1.Text = UCase(Text1.Text) Text1.SelStart = Len(Text1.Text) End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii > 122 Or KeyAscii < 48 Or _ (KeyAscii < 65 And KeyAscii > 57) Or _ (keyascci > 90 And KeyAscii < 97) Then KeyAscii = 0 End If End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionIf InStr("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ", Chr(KeyAscii)) 0 Then KeyAscii 0
Private Sub Text1_Change() Text1.Text = UCase(Text1.Text) Text1.SelStart = Len(Text1.Text) End Sub Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) Clipboard.Clear End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If InStr("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ", Chr(KeyAscii)) 0 Then KeyAscii 0 End Sub Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer) Clipboard.Clear End Sub Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Clipboard.Clear End Sub Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Clipboard.Clear End Sub
Dim mydate As Object 'à remplacer par Dim mydata As Object
Cependant, pourrais tu m'expliquer le contenu du code "array" car j'ai du mal a comprendre .