事实上利用vba也是调用的api来实现简繁转换,tcscconverter也是个dll,与调用api类似,但未见有资料公开,下面提供一个vba转换简繁的函数供测试Private Declare Function LCMapString Lib "kernel32" Alias "LCMapStringA" (ByVal Locale As Long, _
ByVal dwMapFlags As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, ByVal lpDestStr As String, ByVal cchDest
As Long) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Dim STf As String '繁体字符串
Dim STj As String ' 简体字符串
Dim STlen As Long ' 待转换字串长度
Sub SC2TC() 'Gb码简体转繁体
STj = "中华人民共和国"
STlen = lstrlen(STj)
STf = Space(STlen)
LCMapString &H804, &H4000000, STj, STlen, STf, STlen
Debug.Print STf
End Sub
Sub TC2SC() 'Gb码繁体转简体
STf = "中華人民共和國"
STlen = lstrlen(STf)
STj = Space(STlen)
LCMapString &H804, &H2000000, STf, STlen, STj, STlen
Debug.Print STj
End Sub
在vba中根据需要调用指定的function就可以了,另外tcscconverter也是无法转换图形中的文本,可以利用个vba程序来枚举图形进行转换来弥补这一不足 |