Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim a() As Byte
Function trans(ByVal x As String, ByVal types As Integer)
Dim s() As String, b() As Byte, i As Long, x0 As Integer, x1 As Single, x2 As Double, x3 As Date
s = Split(x, " ")
ReDim b(UBound(s))
For i = 0 To UBound(s)
b(i) = CInt("&H" & s(i))
Next
If types = 1 Then CopyMemory x0, b(0), 2: trans = x0 'to integer
If types = 2 Then CopyMemory x1, b(0), 4: trans = x1 ' to single
If types = 3 Then CopyMemory x2, b(0), 8: trans = x2 ' to double
If types = 4 Then CopyMemory x3, b(1), 8: trans = x3 ' to date
End Function
Private Sub Command1_Click()
Print trans("0A 11", 1)
Print trans("A4 70 9D 3F", 2)
Print trans("00 EF E3 2D 8D 1E D9 E2 40", 3)
Print trans("00 EF E3 2D 8D 1E D9 E2 40", 4)
End Sub