在excel中的vba中声明一个unicode字符串 [英] declaring a unicode string in vba in excel
本文介绍了在excel中的vba中声明一个unicode字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个将希腊字符转换为拉丁字符的替代().
I am trying to create a substitute() that will convert greek characters to latin.
问题是声明后
Dim Source As String
Source = "αβγδεζηικλμνξοπρστθφω"
来源被解释为áâãäåæçéêëìíííðñóôõöù"
有没有办法在声明级别使用 unicode?p>
Source is interpreted as "áâãäåæçéêëìíîïðñóôõöù"
is there any way use unicode at declaration level?
推荐答案
你可以试试StrConv
:
StrConv("αβγδεζηικλμνξοπρστθφω", vbUnicode)
来源:http://www.techonthenet.com/excel/formulas/strconv.php
另一个解决方案:
您可以通过以下程序获得每个希腊字符(小写和大写):
You can get every greek character (lower and upper case) thanks to this procedure:
Sub x()
Dim i As Long
For i = 913 To 969
With Cells(i - 912, 1)
.Formula = "=dec2hex(" & i & ")"
.Offset(, 1).Value = ChrW$(i)
End With
Next i
End Sub
例如,您可以创建一个数组来查找字符.
You can create an array to find the char for instance.
来源:http://www.excelforum.com/excel-programming/636544-adding-greek-letters.html
这是一个构建你想要的字符串的子:
Here is a sub to build the string you wanted:
Sub greekAlpha()
Dim sAlpha As String
Dim lLetter As Long
For lLetter = &H3B1 To &H3C9
sAlpha = sAlpha & ChrW(lLetter)
Next
End Sub
这篇关于在excel中的vba中声明一个unicode字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文