Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Page Breaks not setting 1

Status
Not open for further replies.

TimGoff

Technical User
Jul 16, 2002
166
GB
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






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top