zoom38
06-01-2009, 06:17 PM
Hello all,
Is there a way to print preview a hidden sheet? My code below works if I set the sheet to visible but doesn't work if the sheet remains hidden.
Sub PrintBothPlatoonsMain()
Dim ThisSheet As Worksheet
Set ThisSheet = ActiveSheet
Application.ScreenUpdating = False
Application.EnableEvents = False
Module1.DoProtect False
Sheets("Both Platoons").Visible = True
Call BothPlatoonsSheet
Call PrintSetupForBothPlatoons
Call PrintPreview
Sheets("Both Platoons").Visible = False
'Call PrintCopies
Module1.DoProtect True
ThisSheet.Activate
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Sub PrintSetupForBothPlatoons()
Dim LastRow As Long
Sheets("Both Platoons").Activate
'Find The Last Row On The Worksheet
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.CenterVertically = True
.LeftMargin = Application.InchesToPoints(1.06)
.RightMargin = Application.InchesToPoints(0)
.PaperSize = xlPaperLegal
.PrintArea = "$A$1:$AF" & LastRow
.Zoom = 93
'.Zoom = False
'.FitToPagesWide = 1
End With
End Sub
Sub PrintPreview()
'Preview Sheet
' ActiveWindow.SelectedSheets.PrintPreview
' ActiveWindow.PrintPreview
ActiveSheet.PrintPreview
End Sub
Thanks
Gary
Is there a way to print preview a hidden sheet? My code below works if I set the sheet to visible but doesn't work if the sheet remains hidden.
Sub PrintBothPlatoonsMain()
Dim ThisSheet As Worksheet
Set ThisSheet = ActiveSheet
Application.ScreenUpdating = False
Application.EnableEvents = False
Module1.DoProtect False
Sheets("Both Platoons").Visible = True
Call BothPlatoonsSheet
Call PrintSetupForBothPlatoons
Call PrintPreview
Sheets("Both Platoons").Visible = False
'Call PrintCopies
Module1.DoProtect True
ThisSheet.Activate
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Sub PrintSetupForBothPlatoons()
Dim LastRow As Long
Sheets("Both Platoons").Activate
'Find The Last Row On The Worksheet
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.CenterVertically = True
.LeftMargin = Application.InchesToPoints(1.06)
.RightMargin = Application.InchesToPoints(0)
.PaperSize = xlPaperLegal
.PrintArea = "$A$1:$AF" & LastRow
.Zoom = 93
'.Zoom = False
'.FitToPagesWide = 1
End With
End Sub
Sub PrintPreview()
'Preview Sheet
' ActiveWindow.SelectedSheets.PrintPreview
' ActiveWindow.PrintPreview
ActiveSheet.PrintPreview
End Sub
Thanks
Gary