Hi I have a program which asks user for some inputs. Builds an array based on the output called fArray. Then writes fArray to a csv file (I need the output to be view-able in excel). The problem I am having is that sometimes fArray will have more elements than lines in an excel spreadsheet. In this case my current code has no problem writing all the values to the csv file but when I open the csv file it only shows 1,048,576 values(row limit in excel).

Is there a way to write say the first million values to pg1 of my csv file then second million to pg 2 and so on?
Or any other suggestions. My data needs to output like...
Code:
     var1_value1     var2_value1     ... varn_value1
     var1_value2     var2_value2     ... varn_value2
Because the number of variables(columns in output) is set by user I dont want to move over x columns and start back at the top of current page. But instead start outputting in same format on a second page.

Below is what I currently have.
Code:
        Dim strRelFilename As String = "Resources\TestCSV.csv"

        'Get the path of the executable (i.e., the main app-directory).
        Dim strStartupPath As String = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)

        Dim strFullFilename As String = Path.Combine(strStartupPath, strRelFilename)
        'Stop if the CSV doesn't exist
        If Not File.Exists(strFullFilename) Then
            MsgBox(strRelFilename & " doesn't exist")
            Return
        End If

        Dim sb As New Text.StringBuilder

        For g As Long = 0 To numCombos - 1

            For y As Long = 0 To numVars - 1
                sb.Append(fArray(y)(g) + ",")
            Next
            sb.Remove(sb.Length - 1, 1) 'Remove trailing ","
            sb.Append(Environment.NewLine) 'Finish the current line
        Next

        'Write the file
        My.Computer.FileSystem.WriteAllText(strFullFilename, sb.ToString(), False)
Any help is appreciated. Thanks!