Dim a As String
a = InputBox("输入一个字符,如果过位,系统将截取第一位,如果留空,系统取小写a")
If Len(a) = 0 Then
a = "a"
ElseIf Len(a) > 1 Then
a = Mid(a, 1, 1)
End If
If Asc(a) >= Asc("a") And Asc(a) <= Asc("z") Then MsgBox "字符 " & a & " 为小写字母"
If Asc(a) >= Asc("A") And Asc(a) <= Asc("Z") Then MsgBox "字符 " & a & " 为大写字母"
这个可以
Private Sub Form_Load()
Dim a As String
a = Right(InputBox("输入"), 1)
Select Case Asc(a)
Case Asc("a") To Asc("z")
MsgBox "小写字母"
Case Asc("A") To Asc("Z")
MsgBox "大写字母"
Case Else
MsgBox "非字母"
End Select
End Sub
Dim
a
As
String
a
=
InputBox("输入一个字符,如果过位,系统将截取第一位,如果留空,系统取小写a")
If
Len(a)
=
0
Then
a
=
"a"
ElseIf
Len(a)
>
1
Then
a
=
Mid(a,
1,
1)
End
If
If
Asc(a)
>=
Asc("a")
And
Asc(a)
<=
Asc("z")
Then
MsgBox
"字符
"
&
a
&
"
为小写字母"
If
Asc(a)
>=
Asc("A")
And
Asc(a)
<=
Asc("Z")
Then
MsgBox
"字符
"
&
a
&
"
为大写字母"
Private Sub Form_Load()
Dim a As String
a = Left(InputBox("输入"), 1)
Select Case Asc(a)
Case Asc("0") To Asc("9")
MsgBox "数字"
Case Asc("a") To Asc("z")
MsgBox "小写字母"
Case Asc("A") To Asc("Z")
MsgBox "大写字母"
Case Else
MsgBox "其他字符"
End Select
End Sub
Private Sub Command1_Click()
Dim strTmp As String
Err1:
strTmp = InputBox("请输入一个字符:")
If Len(strTmp) > 1 Then GoTo Err1
If Len(strTmp) < 1 Then Exit Sub
If Not IsNumeric(strTmp) Then
If Asc(strTmp) >= Asc("a") And Asc(strTmp) <= Asc("z") Then
MsgBox "小写字母!"
ElseIf Asc(strTmp) >= Asc("A") And Asc(strTmp) <= Asc("Z") Then
MsgBox "大写字母!"
Else
MsgBox "非字母!"
End If
Else
MsgBox "非字母!"
End If
End Sub