warrenstow
Programmer
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.
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.