Workbook_BeforePrint Stopped Working

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
 
D

Dave Peterson

Did you remember to allow macros to run when you opened the workbook and saw the
prompt?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top