中文转换UNCODE函数(VB)

2010-08-28 10:48:01来源:西部e网作者:

Public Function ascg(smsg As String) As String
  Dim si, sb As Integer
  Dim stmp As Integer
  Dim stemp As String
  sb = Len(smsg)
  ascg = ""
  For si = 1 To sb
   stmp = AscW(Mid(smsg, si, 1))
   If Abs(stmp) < 127 Then
   stemp = "00" & Hex(stmp)
   Else
   stemp = Hex(stmp)
   End If
   ascg = ascg & stemp
  Next si
  ascg = Trim(ascg)
End Function 
关键词:VBUNCODE