spacecaptainsuperguy
Board Regular
- Joined
- Dec 30, 2004
- Messages
- 202
- Office Version
- 365
- Platform
- Windows
I have a macro that when I recorded it, I used the page break preview to make sure that the document would only be one page width wide. I used the page break mode to drag the page break out to the edge of the document. All has worked fine (for years now) until I ran into a document that was only one page wide already. Here is the chunk of code that I'm having the issue with and it's the 2nd line that is creating the error.
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
ActiveWindow.View = xlNormalView
I know there must be a way to tell the macro to only do this if the document is larger than one page wide but I haven't been able to figure out how to do that.
Any thoughts?
thanks in advance.
SpaceCaptainSuperGuy
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
ActiveWindow.View = xlNormalView
I know there must be a way to tell the macro to only do this if the document is larger than one page wide but I haven't been able to figure out how to do that.
Any thoughts?
thanks in advance.
SpaceCaptainSuperGuy