PDA

View Full Version : My Print Layout Reverts Right Before Printing



mferrisi
03-22-2007, 03:25 PM
Hello,

I format the page so that the page breaks are moved and the layout is changed to landscape. When the 'print" option is selected, or when the subroutine ends, the format reverts to the way it was before the change. Am I missing something? Thank you,

Matt

ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
Set ActiveSheet.HPageBreaks(1).Location = Range("A" & 76 * x)
Set ActiveSheet.HPageBreaks(2).Location = Range("A152")
Set ActiveSheet.HPageBreaks(3).Location = Range("A229")

With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Dim Answer As String
Dim MyNote As String
'Place your text here
MyNote = "Would You Like to Print the Formatted Document?"
'Display MessageBox
Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Print?")
If Answer = vbYes Then
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=3, Copies:=1, Collate _
:=True
Else

End If

End Sub