Private Sub Command1_Click()
Dim b() As Byte, s As String
'b是你要往串口发的字节数组
b = StrConv(Right(String(6, "0") & Hex(Text1), 6), vbFromUnicode)
'以下是验证
For i = 0 To UBound(b)
s = s & Hex(b(i))
Next
Debug.Print s
'以下是还原
s = Format(Val("&H" & StrConv(b, vbUnicode)), String(6, "0"))
Debug.Print s
End Sub
Private Sub Form_Load()
Text1.Text = "000042"
End Sub
&2ota;
Ι