another simple way

Private Sub TextNama_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Chr(KeyAscii) Like "*[1234567890,._<>;':~`\\/!...@#$%^&*()=+-]*" Then
    KeyAscii = 0
End If
End Sub

Private Sub IDUser_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

     If InStr("0123456789,.", Chr(KeyAscii)) = 0 Then KeyAscii = 0
        If Chr(KeyAscii) Like "*[,._<>;':~`\\/!...@#$%^&*()=+]*" Then
        KeyAscii = 0
    End If
End Sub



Pada tanggal 03/03/09, zainul ulum <[email protected]> menulis:
> Coba tambahkan procedure sbb:
>
>
>
> Private Sub IDUser_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
>
>     KeyAscii = AngkaSaja(KeyAscii)
>
> End Sub
>
>
>
> Private Sub TextNama_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
>
>     KeyAscii = HurufSaja(KeyAscii)
>
> End Sub
>
> Private Function AngkaSaja(an_ascii As MSForms.ReturnInteger) As Integer
>
>     Const strAngka = "0123456789"
>
>     If InStr(strAngka, Chr(an_ascii)) = 0 Then
>
>         AngkaSaja = 0
>
>     Else
>
>         AngkaSaja = an_ascii
>
>     End If
>
> End Function
>
> Private Function HurufSaja(an_ascii As MSForms.ReturnInteger) As Integer
>
>     Select Case an_ascii
>
>         Case 65 To 90: HurufSaja = an_ascii 'huruf besar
>
>         Case 97 To 122: HurufSaja = an_ascii 'huruf kecil
>
>         Case 32: HurufSaja = an_ascii 'space
>
>         Case Else
>
>         HurufSaja = 0
>
>     End Select
>
> End Function
>
>
>
>   _____
>
> From: yayat ruhimat [mailto:[email protected]]
> Sent: Monday, March 02, 2009 5:19 PM
> To: [email protected]
> Subject: ]] XL-mania [[ Form entri texbox hanya bisa huruf saja
>
>
>
>
> Dear XLMaia
>
>
>
> Saat ini sedang belajar membuat Form Entri, dan sudah coba browse tentang
> entri data melalui textbox hanya huruf saja, tapi sampai saat ini belum
> bisa.
>
>
>
> Untuk jelasnya, saya attach contoh kasus untuk mendapat koreksi/perbaikan
> syntac macro dari teman-teman XLMania
>
>
>
> Atas bantuan teman-teman diucapkan terima kasih.
>
>
>
> Yayat
>
>
>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3901 (20090302) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3901 (20090302) __________
>
>
> The message was checked by ESET NOD32 Antivirus.
>
>
> http://www.eset.com
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3901 (20090302) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>

Kirim email ke