View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_2_] Dave Peterson[_2_] is offline
external usenet poster
 
Posts: 420
Default Workbook_BeforePrint Stopped Working

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



On 08/11/2010 13:49, O.B. wrote:
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


--
Dave Peterson