Function RemoveNarrow(str As String) As String Set regEx = CreateObject("vbscript.regexp") With regEx .Global = 1 .Pattern = "[\x01-\x7f]+" RemoveNarrow = .Replace(str, "") End With End Function Function getCN(str As String) As String Dim iAsc As Integer Dim char As String * 1 For i = 1 To Len(str) char = Mid(str, i, 1) iAsc = Asc(char) If (iAsc >= &HAA40 And iAsc <= &HFEA0) Or (iAsc >= &H8140 And iAsc <= &HA0FE) Then getCN = getCN & char End If Next End Function
摘自ExcelHome