Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
addins stopped working ? KRK New Users to Excel 0 March 16th 10 12:39 PM
excel stopped working Dunk1957 Excel Discussion (Misc queries) 1 June 26th 09 08:09 PM
Add-in stopped working [email protected] Excel Programming 1 January 17th 07 05:49 PM
VB Stopped Working [email protected] Excel Worksheet Functions 1 April 28th 05 01:56 PM
Tab stopped working -- SCOTT-- Excel Programming 0 October 2nd 03 09:14 PM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"