I was exporting into Excel a list of users and the files they “owned” in a selected directory when I ran into an error at row 65,537 in the Excel sheet.
Dim shWorkSheet As Excel.Worksheet = DirectCast(bkWorkBook.Sheets("Sheet1"), Excel.Worksheet) ... For Each File As System.IO.FileInfo In FileCollection(i - 1).FileList shWorkSheet.Cells(RowCounter, 2).Value = File.FullName shWorkSheet.Cells(RowCounter, 3).Value = File.Length RowCounter += 1 Next
So 65,536 was the last row successfully added to the Excel sheet. That number sounded familiar, so I diligently checked and found an MSDN article on Excel. And there, plain as day, was:
A Microsoft Office Excel worksheet contains 65,536 rows and 256 columns.
So I guess I’ll be splitting my records between different sheets. At least it was an easy error to diagnose.