|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
这个跟你使用什么字体应该没什么关系,需要编码转换一下就OK了
- Function Encode(strEncode As String) As String
- '取得十六进制的UNICODE
- Dim i As Long
- Dim chrTmp As String
- Dim ByteLower As String
- Dim ByteUpper As String
- Dim strReturn As String
- For i = 1 To Len(strEncode)
- chrTmp$ = Mid(strEncode, i, 1)
- ByteLower$ = Hex$(AscB(MidB$(chrTmp$, 1, 1)))
- If Len(ByteLower$) = 1 Then ByteLower$ = "0" & ByteLower$
-
- ByteUpper$ = Hex$(AscB(MidB$(chrTmp$, 2, 1)))
- If Len(ByteUpper$) = 1 Then ByteUpper$ = "0" & ByteUpper$
-
- strReturn$ = strReturn$ & "\u" & ByteUpper$ & ByteLower$
- Next
- Encode = strReturn$
- End Function
- Function UnicodeDec(strUnicode As String)
- Dim arr, i%, s$
- arr = Split(strUnicode, "\u")
- For i = 1 To UBound(arr)
- s = s & ChrW(Application.WorksheetFunction.Hex2Dec(arr(i)))
- Next
- UnicodeDec = s
- End Function
复制代码 |
|