Hi all,

I am using the following code to retrieve 700 bytes of data at a time from a long string and work on them in a loop. When it get's to character 18200 (loop 26) I get the overflow error Run-time error '6'.

Sub Create_GSFG_FL(fStr As String)
    Dim TotalLen As Integer
    Dim n As Integer
    Dim Lines As String
    Dim TFHStr As String
    TFHStr = Mid(fStr, 1, 700)
    Call CreateTFH(TFHStr)

    TotalLen = Len(fStr) / 700
    For n = 1 To TotalLen
    
        Lines = Mid(fStr, n * 700 + 1, 700)

'Some code to work with the string

    Next n
End Sub

The string can vary in length anywhere between 50,000 and 2,000,000 character long.

Any idea what I can do to work around this issue?

Many thanks in advance.
David