Function CheckCode(StrChk As String) As String
'判斷是否包含漢字
StrChk = VBA.StrConv(StrChk, vbNarrow)
If (Len(StrChk) <> LenB(StrConv(StrChk, vbFromUnicode))) = False Then
CheckCode = "English/Data"
Exit Function
End If
'判斷文本內碼
For I = 1 To Len(StrChk)
F = Hex(Asc(Mid(StrChk, I, 1)))
L1 = CInt("&H" + Mid(F, 1, 2))
R1 = CInt("&H" + Mid(F, 3, 2))
'GBCode 1>A0H - FEH
'BIG5Code 1>80H - FFH 2>00H-FFH
'MsgBox Val("&H ")
If R1 < 127 Then
CheckCode = "Big5"
Exit Function
End If
Next
CheckCode = "GB"
End Function 作者: xthand 时间: 2006-7-11 19:04
首先感谢两位的回答。我也在本站搜索过,大多是取汉字首拼音,要不就是取得GB2312里的汉字的拼音。