Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _As an example of using CopyMemory, the code snippet below copies 11 elements from one array to another array, without having to reference each and every array slot. Note that in this case, the parameters can be passed ByRef (as for the pDst parameter) or ByVal as for the pSrc parameter. In the last case a pointer to the first element of the source array is obtained with the (hidden) VarPtr function.
(pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Dim i As Integer
Dim Receiver(10) As Long
Dim Source(5 To 15) As Long
For i = 5 To 15
Source(i) = i
CopyMemory Receiver(0), ByVal VarPtr(Source(5)), LenB(Source(5)) * 11