View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phil Hageman[_3_] Phil Hageman[_3_] is offline
external usenet poster
 
Posts: 160
Default Re-Post: Before_Print Sub Doesn't Trigger

This code does not execute when the user clicks on the Print button. The code objective is stated below. One comment made is that in the select line, lower case is specified, where proper case is used in the case line. I changed the text in the case lines to lower case but the code still doesn't work. On thing: this workbook is a template used by many users. The worksheet tabs are typed in just as they appear in the code - Proper case. Does anyone have an idea to fix this code


The object of this code is to reset the scaling and print area in Page Setup €“ before printing begins. It is located in Module2 of the workbook. To test the code, I set the scale at 50% for the worksheets and clicked on the print button. It prints at 50% instead of 95%/90%, as proposed in the code. Its as though Excel doesnt see the code at all. Can someone look through this as suggest a fix? I can compress the file and send it if necessary

Private Sub Workbook_BeforePrint(Cancel As Boolean
Dim wsSheet As Workshee
Dim rng As Range, ar As Rang
Dim lngZ As Lon
For Each wsSheet In ActiveWindow.SelectedSheet
Select Case LCase(wsSheet.Name
Case "Scorecard
lngZ = 9
With wsShee
Set rng = .Range("B1:BA45"
End Wit
Case "Customer", "Financial", "Learning and Growth", "Internal Business Process
lngZ = 9
With wsShee
Set rng = .Range("B1:BA32,B33:BA64,B65:BA96"
End Wit
Exit Su
Case Els
With wsSheet.PageSetu
.FitToPagesWide =
.FitToPagesTall =
End Wit
Exit Su
End Selec
With wsSheet.PageSetu
.Zoom = lng
End Wit
Cancel = Tru
On Error GoTo ErrHandle
Application.EnableEvents = Fals
For Each ar In rn
ar.PrintOu
Nex
Nex
ErrHandler
Application.EnableEvents = Tru
End Su