VB怎样把文本变成&#

来源:百度知道 编辑:UC知道 时间:2024/05/14 16:03:14
&#+数字=字符
〺=&# 12346

Option Explicit

Private Sub Command1_Click()
On Error Resume Next
If Text1.Text = "" Then MsgBox "请输入字符^o^", vbInformation, "提示": Exit Sub

Dim x As Integer, Y As Long
Text2.Text = ""

For x = x + 1 To Len(Text1.Text)

Y = AscW(Right(Text1.Text, (Len(Text1.Text) - x + 1)))

If Y < 0 Then
Y = Y - (-32768)
Y = 32767 + Y + 1
End If

Text2.Text = Text2 & "&# " & Y & vbCrLf
DoEvents

Next

End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
End Sub

Private Sub Command3_Click()
If Text2.Text = "" Then MsgBox "请转换数据后复制", vbInformation, "警告": Exit Sub

Clipboard.Clear
Clipboard.SetText Text2.Text

End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

**