【发布时间】:2013-02-18 20:56:43
【问题描述】:
我需要用纯 ASCII 代替 Excel 电子表格中的 Unicode 字符。例如,将 Ståle 转换为 Stale。
以下内容在 Excel 2013 中运行良好。但在 Excel 2010 中,“?”显示而不是有问题的字符。有任何想法吗?请注意,在 Excel 2010 中可以正确检测到非 Ascii 字符,但不会显示这些字符。
char = Mid(val, i, 1)
char_code = AscW(char)
If char_code > 127 Then
MsgBox ("Problem with " & c.Address & " [" & char_code & "] " &
StrConv(ChrW(char_code), vbUnicode))
End If
我也试过了
MsgBox ("Problem with " & char & " " & ChrW(char_code))
它再次适用于 Excel 2013,但不适用于 Excel 2010。
【问题讨论】:
-
也许作为一个选项,这将是好的:asap-utilities.com/…
-
StrConv 依赖于默认代码页。我假设您正在不同的计算机上尝试此操作。装有 Excel 2010 的计算机是否有正确的代码页?将 char_code 转换为十六进制会是更好的选择吗?
标签: excel internationalization excel-2010 vba