Public Function AsciiToHex(strChinese As String) As String '汉字转16进制ASCII
Dim iLen As Long
iLen = Len(strChinese)
Dim tmpByte() As Byte
Dim iNext As Long '循环所用字段
Dim iTmp As Integer
Dim strTmp As String
For iNext = 1 To iLen
iTmp = Abs(Asc(Mid(strChinese, iNext, 1)))
If iTmp > 127 Then '汉字编码
tmpByte = StrConv(Mid(strChinese, iNext, 1), vbFromUnicode)
strTmp = strTmp & Hex(tmpByte(0))
strTmp = strTmp & Hex(tmpByte(1))
Else
strTmp = strTmp & Hex(iTmp)
End If
Next
AsciiToHex = strTmp
End Function
Dim iLen As Long
iLen = Len(strChinese)
Dim tmpByte() As Byte
Dim iNext As Long '循环所用字段
Dim iTmp As Integer
Dim strTmp As String
For iNext = 1 To iLen
iTmp = Abs(Asc(Mid(strChinese, iNext, 1)))
If iTmp > 127 Then '汉字编码
tmpByte = StrConv(Mid(strChinese, iNext, 1), vbFromUnicode)
strTmp = strTmp & Hex(tmpByte(0))
strTmp = strTmp & Hex(tmpByte(1))
Else
strTmp = strTmp & Hex(iTmp)
End If
Next
AsciiToHex = strTmp
End Function