Public Function checkhz(iChar As String) As String Dim asc1 As Integer, d1 As String, d2 As String asc1 = Asc(iChar) If asc1 >= 0 Then checkhz= "en" Else hstr = Hex(asc1) d2 = Left(hstr, 2) d1 = Right(hstr, 2) If d1 >= "A0" And d1 <= "FE" And _ d2 >= "A0" And d2 <= "FE" Then checkhz= "简体" ElseIf d1 >= "80" And d1 <= "FF" And _ d2 >= "00" And d2 <= "FF" Then checkhz= "繁体" Else checkhz= "other" End If
End If End FunctionPrivate Sub Command1_Click() MsgBox checkhz("中") End Sub
Dim asc1 As Integer, d1 As String, d2 As String
asc1 = Asc(iChar)
If asc1 >= 0 Then
checkhz= "en"
Else
hstr = Hex(asc1)
d2 = Left(hstr, 2)
d1 = Right(hstr, 2)
If d1 >= "A0" And d1 <= "FE" And _
d2 >= "A0" And d2 <= "FE" Then
checkhz= "简体"
ElseIf d1 >= "80" And d1 <= "FF" And _
d2 >= "00" And d2 <= "FF" Then
checkhz= "繁体"
Else
checkhz= "other"
End If
End If
End FunctionPrivate Sub Command1_Click()
MsgBox checkhz("中")
End Sub
比如对【你好123abc】判断其中含有123abc字母