Hi,
I am using the CopyFromRecordset method to copy from a recordset to an excel spreadsheet. See code below:
The problem I am facing is that for every new sheet, it starts copying from the beginning of the recordset! Can anyone help me with this?![]()
Thanks,
Hex
Code:Do oSheet.Range(rangeCell).CopyFromRecordset rs, 65500 rs.Move 65500 If rs.EOF = True Then Exit Do End If subLogCommand "We're at: " & rs.AbsolutePosition With oSheet.Range("a1").Resize(1, rs.Fields.Count) .EntireColumn.AutoFit '.EntireColumn.WrapText = True End With sheetnum = sheetnum + 1 oBook.Worksheets.Add Set oSheet = oBook.Worksheets("Sheet" & sheetnum) oSheet.Activate Call excelHeader(xlsRowNum, hdgCriteria, oSheet) Loop




Reply With Quote