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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I remove vpagebreaks using code

Status
Not open for further replies.

warrenstow

Programmer
Nov 16, 2001
1
US
I'm trying to remove any vPageBreaks using VB.

This is the code I'm using

If xlBook.ActiveSheet.VPageBreaks.Count > 0 Then
xlBook.ActiveSheet.VPageBreaks(1).DragOff xlToRight, 1
End If

I get the following error on the second line

1004 - Application-defined or object-defined error


The code does work in an Excel Macro without the xlBook part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top