Delet PageBreaks in VB


Posted by Dave S on January 30, 2002 1:47 PM

I'm trying to write a procedure to delete all the page breaks on a sheet. This is the code I've tried so far:

Dim x As Integer
Dim n As Integer

x = Summary.VPageBreaks.Count
For n = 1 To x
Summary.VPageBreaks.Item(n).Delete
Next n
I've also tried numerous other variations of this that don't work either (this returns an Application Defined or Object Defined Error). Is there an easy way to do this?

Thanks,
Dave

Posted by Joe Was on January 30, 2002 2:53 PM

Re: Delet PageBreaks in VB

x = Summary.VPageBreaks.Count For n = 1 To x Summary.VPageBreaks.Item(n).Delete Next n



Posted by Joe Was on January 30, 2002 2:55 PM

Re: Delet PageBreaks Code

This will delete all manual set page breaks, but will not work on automatically set page breaks

Cells.PageBreak to xlPageBreakNone

Hope this helps. JSW

x = Summary.VPageBreaks.Count For n = 1 To x Summary.VPageBreaks.Item(n).Delete Next n