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