|
看看這個是否能幫到你
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
|
|