在 Devstudio6Editor 中添加一下代码,然后在 工具-自定义-宏 中找到 TransUnicode 将它拖到工具栏即可实现汉字的在线转换,方便极了...,对了该方法是同事整的哈。
Sub TransUnicode()
' 说明: 将给定字符串转换为UNICODE码。
Dim win As EnvDTE.Window
Dim TypeOfFile As Integer
Dim SrcStr As String
Dim XStr As String
Dim DstStr As String
Dim i, tc As Integer
Dim ts As String
win = DTE.ActiveWindow
If win.Type <> EnvDTE.vsWindowType.vsWindowTypeDocument Then
MsgBox("This macro can only be run when a text editor window is active.")
Else
TypeOfFile = FileType(DTE.ActiveDocument)
SrcStr = DTE.ActiveDocument.Selection.text()
XStr = StrConv(SrcStr, vbunicode)
For i = 0 To XStr.Length - 1
tc = AscW(XStr.Chars( i ))
ts = Hex(tc)