Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal dwMemSize As Long)
Function SplitLong(ByVal L As Long, Optional B0 As Byte, Optional B1 As Byte, Optional B2 As Byte, Optional B3 As Byte) As Byte()
Dim B(0 To 3) As Byte
CopyMemory B(0), L, 4
B0 = B(0)
B1 = B(1)
B2 = B(2)
B3 = B(3)
SplitLong = B
End Function
You can retrive the individual bytes in the 4-byte long values by passing optional parameters (B0 to B4) to this function. Or retrieve the 4 bytes as an array as the return value of the function.
Dim B0 As Byte,B1 As Byte, B2 As Byte, B3 As Byte
Dim Bytes() As Byte
Bytes = SplitLong(93874912, B0, B1, B2, B3)