Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Application.ScreenUpdating = False
- Dim origScreenUpdating As Boolean
- origScreenUpdating = Application.ScreenUpdating
- Application.ScreenUpdating = False
- Dim origCalcMode As xlCalculation
- origCalcMode = Application.Calculation
- Application.Calculation = xlCalculationManual
- With ActiveSheet.PageSetup
- If .PrintHeadings <> False Then .PrintHeadings = False
- If .PrintGridlines <> False Then .PrintGridlines = False
- If .PrintComments <> xlPrintNoComments Then .PrintComments = xlPrintNoComments
- ' Etc...
- End With
- Application.ScreenUpdating = origScreenUpdating
- Application.Calculation = origCalcMode
- Public Sub CopyPageSetupToAll(ByRef SourceSheet As Worksheet)
- ' Raise error if invalid source sheet is passed to procedure
- '
- If (SourceSheet Is Nothing) Then
- Err.Raise _
- Number:=vbErrorObjectVariableNotSet, _
- Source:="CopyPageSetupToAll", _
- Description:="Unable to copy Page Setup settings: " _
- & "invalid reference to source sheet."
- Exit Sub
- End If
- SourceSheet.Activate
- With SourceSheet.PageSetup
- ' ...
- ' place PageSetup customizations here
- ' ...
- End With
- SourceSheet.Parent.Worksheets.Select
- Application.SendKeys "{ENTER}", True
- Application.Dialogs(xlDialogPageSetup).Show
- End Sub
- Public Sub CopyPageSetupToAll(ByRef SourceBook As Workbook)
- Dim tempSheet As Worksheet
- ' Raise error if invalid workbook is passed to procedure
- '
- If (SourceBook Is Nothing) Then
- Err.Raise _
- Number:=vbErrorObjectVariableNotSet, _
- Source:="CopyPageSetupToAll", _
- Description:="Unable to copy Page Setup settings: " _
- & "invalid reference to source workbook."
- Exit Sub
- End If
- Set tempSheet = SourceBook.Worksheets.Add
- tempSheet.Activate
- With tempSheet.PageSetup
- ' ...
- ' place PageSetup customizations here
- ' ...
- End With
- SourceBook.Worksheets.Select
- Application.SendKeys "{ENTER}", True
- Application.Dialogs(xlDialogPageSetup).Show
- tempSheet.Delete
- Set tempSheet = Nothing
- End Sub
Add Comment
Please, Sign In to add comment