Hi,
I'm formatting a spreadsheet using VB6, everything is working apart from I can't get the page breaks to set. I set the sheet to 1 page wide, and 2 pages tall. It appears difficult actually using the functions in Excel to set the page breaks, apart from in page break preview. Here is what i'm using.....
Set objExcel = CreateObject("Excel.Application.10"
With objExcel.Application
.Workbooks.Open FileName:="c:\tim.xls"
With .ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 2
end with
.ActiveSheet.ResetAllPageBreaks
.Cells(64, 1).Select
.ActiveSheet.HPageBreaks.Add Before:=ActiveCell
and i have tried...
.ActiveSheet.Rows(64).PageBreak = xlPageBreakManual
and ...
.ActiveSheet.HPageBreaks(1).Location = .ActiveCell
Some create and error, or some don't show errors, but just don't work...
Any help much appreciated
Thanks in advance
Tim
I'm formatting a spreadsheet using VB6, everything is working apart from I can't get the page breaks to set. I set the sheet to 1 page wide, and 2 pages tall. It appears difficult actually using the functions in Excel to set the page breaks, apart from in page break preview. Here is what i'm using.....
Set objExcel = CreateObject("Excel.Application.10"
With objExcel.Application
.Workbooks.Open FileName:="c:\tim.xls"
With .ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 2
end with
.ActiveSheet.ResetAllPageBreaks
.Cells(64, 1).Select
.ActiveSheet.HPageBreaks.Add Before:=ActiveCell
and i have tried...
.ActiveSheet.Rows(64).PageBreak = xlPageBreakManual
and ...
.ActiveSheet.HPageBreaks(1).Location = .ActiveCell
Some create and error, or some don't show errors, but just don't work...
Any help much appreciated
Thanks in advance
Tim