Hello!

I need to copy a big file (over 2 gb).
I am distributing this work over several activex exes of which each copies a "chunk".

I am having a problem distributing the work over them as I encounter an overflow error, no matter what I try.
I used modulo and int.

Can somebody advise me how to solve this?

Thank you.

Here is my prototype function:

Code:
Private Sub Form_Load()

    Dim lCountWorkers&
    Dim cBytesToBeCopiedByEach As Currency
    
    Dim cFileSize As Currency
    cFileSize = 2247442432#
    
    
    CalculateNumberOfWorkersAndWork cFileSize, 6, lCountWorkers, cBytesToBeCopiedByEach

End Sub
Public Sub CalculateNumberOfWorkersAndWork(ByVal uFileSize As Currency, ByVal uMaxWorkers As Long, ByRef uCountWorkers As Long, ByRef uBytesToBeCopiedByEach As Currency)

    'My code is really crappy. I have tried a lot. This version is just a mockup to show you what I want to do
    'I am not even sure if this approach would yield the correct result even if it would not throw the overflow error
    uBytesToBeCopiedByEach = uFileSize / uMaxWorkers
    

    Dim wholeParts As Currency
    wholeParts = uFileSize \ uMaxWorkers

    Dim totalWholePartSize As Currency
    totalWholePartSize = wholeParts * uMaxWorkers


    If totalWholePartSize = uFileSize Then
        uCountWorkers = uMaxWorkers
    Else
        uCountWorkers = wholeParts + 1
    End If

    If uFileSize < uMaxWorkers Then
        uCountWorkers = uFileSize
        uBytesToBeCopiedByEach = 1
    End If

End Sub
This one as well throws an overflow error