Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_BeforePrint Stopped Working
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
addins stopped working ? | New Users to Excel | |||
excel stopped working | Excel Discussion (Misc queries) | |||
Add-in stopped working | Excel Programming | |||
VB Stopped Working | Excel Worksheet Functions | |||
Tab stopped working | Excel Programming |