Private Sub Command1_Click()
Const st = "0123456789ABCDEF"
Dim s, ch, rs As String
Dim m, r1, r2, n As Integer
For i = 1 To Len(s)
ch = Mid(s,i,1)
If ch > "9" Or ch < "0" Then
r2 = m Mod 16
rs = rs + Mid(st, r1 + 1, 1) + Mid(st, r2 + 1, 1)
m = 0
Else
m = m * 10 + Val(ch)
End If
Next i
Text2.Text = "#" + rs
End Sub