Workbook_BeforePrint Stopped Working

  • Thread starter Thread starter O.B.
  • Start date Start date
O

O.B.

I have the following routine associated with “ThisWorkbook” in my
Visual Basic editor for Excel. It worked fine until I closed
the .xlsm file and reopened it. Now, it doesn’t even execute when
printing. How do I enable it again?

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim commonHeader As String

ActiveSheet.PageSetup.CenterHeader = "UNCLASSIFIED"
ActiveSheet.PageSetup.LeftHeader = "GeoBridge SRS"
ActiveSheet.PageSetup.RightHeader = Sheets("Cover").Range("$A$6")
& " - " & _

Format(Sheets("Cover").Range("$A$5"), "DD MMMM YYYY")
ActiveSheet.PageSetup.CenterFooter = "UNCLASSIFIED"

' Exceptions
Sheets("Cover").PageSetup.CenterHeader = "UNCLASSIFIED"
Sheets("Functional Requirements").PageSetup.RightFooter = "Page "
& "&P" & vbCr & "UNCLASSIFIED"

End Sub
 
Did you remember to allow macros to run when you opened the workbook and saw the
prompt?
 
Back
Top