pavane Level: VB Lord Registered: 26-04-2004 Posts: 181
IF ALPHABETIC test
I need to test a character for being alphabetic. It would be easy except that I have to allow all accented characters as well, so a lookup list is not practicable.
Does anyone know of a function or API call which would do the job?
13-06-2008 at 09:15 AM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 537
Re: IF ALPHABETIC test
Paste this in a new module and try :
Option Explicit
Public Declare Function IsCharAlpha Lib "user32" Alias "IsCharAlphaA" (ByVal cChar As Byte) As Long
Public Function Alphabetic(strIN As String) As Boolean
Dim bIN As Byte
Dim blReturn As Boolean
bIN = CByte(Asc(Left$(strIN, 1)))
If IsCharAlpha(bIN) = 0 Then
blReturn = False
Else
blReturn = True
End If
Alphabetic = blReturn
End Function
Private Sub testfn()
MsgBox Alphabetic("*")
End Sub
Put your cursor in the testfn sub and hit F5 to test
____________________________ multi-tasking - the ability to hang more than one app. at the same time.