View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Re-Post: Before_Print Sub Doesn't Trigger

watchout for Bob's line:
Case "Customer", "fnancial", "learning and growth", "internal business process"

He got most of them <bg, but induced a typo:
Case "customer", "financial", "learning and growth", "internal business process"

Bob Phillips wrote:

Phil,

Same as I told you last time. Correct the case, put it in THisWorkbok, and
who knows, it might work

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wsSheet As Worksheet
Dim rng As Range, ar As Range
Dim lngZ As Long
For Each wsSheet In ActiveWindow.SelectedSheets
Select Case LCase(wsSheet.Name)
Case "scorecard"
lngZ = 95
With wsSheet
Set rng = .Range("B1:BA45")
End With
Case "Customer", "fnancial", "learning and growth", "internal
business process"
lngZ = 90
With wsSheet
Set rng = .Range("B1:BA32,B33:BA64,B65:BA96")
End With
Exit Sub
Case Else
With wsSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Exit Sub
End Select
With wsSheet.PageSetup
.Zoom = lngZ
End With
Cancel = True
On Error GoTo ErrHandler
Application.EnableEvents = False
For Each ar In rng
ar.PrintOut
Next
Next
ErrHandler:
Application.EnableEvents = True
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Phil Hageman" wrote in message
...
Dave, Thanks for your answer. I move the code to ThisWorkbook (deleted

from Module2) - still not working. I also looked at Chip's and your web
pages but for me (not a programmer) it was like drinking from a fire hose!
Could I prevail upon you to modify the code to accomodate proper case. I'm
sure you are correct - the use of LCase will never hook up with the
worksheet names. But I'm locked into the worksheet names.

Thanks,
Phil


--

Dave Peterson