Read/Write chunks of binary data - I have simplified the code here - so this is simply an example - you have to set your own paramters

The code listed here – reads chunks of data from one binary file and saves it to another binary file. In this example I have 20K observations (samples) – for each observation I have 1100 single precision values. This code reads all the 1100 single values for each observation in one operation rather than a loop reading 1100 single values one by one. That way the code is much faster.

Code:
Public Sub ReadWriteBinary(ByVal PathNameSourceFile As String, ByVal PathNameDestinationFile As String)
   
    Dim Buffer As String
    Dim NumberOfValues As Long, Xlong As Long
    
    ' The number of blocks of data - In this case I have 20K records where I want to copy data
    NumObservations = 20000
    ' This example has 1100 values each a 4 byte number of the data type single precision.
    NumberOfValues = 1100
    'In this example I want to read a series of 4 byte Single data types (Single) for each observation
    Xlong = 4 * NumberOfValues
    ' Set the buffer for each chunk of data to read
    Buffer = Space$(Xlong)
    
    Open PathNameSourceFile For Binary As #2
    Open PathNameDestinationFile For Binary As #1
    For iix = 0 To NumObservations - 1
        ' This is the location in Bytes where the source data reside
        LocalOfDataSource = iix * 5000 + 512
        'This is the location in Bytes where I want to save the data
        LocalOfDestinationData = iix * 8000 + 1024
        ' reads a chunk of data from the source file.
        Get #2, LocalOfDataSource, Buffer
        'Saves the data just read to the destination file
        Put #1, LocalOfDestinationData, Buffer
    Next iix
    Close #1
    Close #2
End Sub