Databaseguy
MIS
I have routine that creates a spreadsheet with multiple tabs in Excel from an Access Database. Within the individual tabs there are groupings of data which I want to keep together. All is well and good except for where the page breaks go. I have a counter, and insert a page break when the counter reaches a certain value, but Excel is still inserting the default page breaks. Any ideas ??
If RowCounter > 790 Then
objExcel.Range(objExcel.Cells(X - 4, 1), objExcel.Cells(X - 4, rst.Fields.Count - 2)).Select
With objExcel.Selection
objExcel.ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
End With
RowCounter = 0
Else
End If
If RowCounter > 790 Then
objExcel.Range(objExcel.Cells(X - 4, 1), objExcel.Cells(X - 4, rst.Fields.Count - 2)).Select
With objExcel.Selection
objExcel.ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
End With
RowCounter = 0
Else
End If