![]() |
Code modification to accomodate scaling and print areas.
Tom,
Thanks for your reply. Your assumptions about the worksheets are all correct I pasted the code into a general module, and am receiving a compile error on the sixth line - the text Icase is highlighted, with a message "Expected: Case" As a test, using Page Setup, I resized all the worksheets to 50%, expecting the code to make printed copy defined and sized per the code. It prints as 50%. Maybe correction of the compile error will make the code work Phil |
Code modification to accomodate scaling and print areas.
there is no Icase in the code
there is ? lcase(wsSheet.name) sheet2 Which works fine. However, in that lin of code, CASE got omitted. It should be Select Case LCase(wsSheet.Name) But there were a couple of other typos. Try this 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", "Financial", "Learning", "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 -- Regards, Tom Ogilvy "Phil Hageman" wrote in message ... Tom, Thanks for your reply. Your assumptions about the worksheets are all correct. I pasted the code into a general module, and am receiving a compile error on the sixth line - the text Icase is highlighted, with a message "Expected: Case". As a test, using Page Setup, I resized all the worksheets to 50%, expecting the code to make printed copy defined and sized per the code. It prints as 50%. Maybe correction of the compile error will make the code work. Phil |
Code modification to accomodate scaling and print areas.
Tom
I entered the code and it doesn't work. Likely, I have omitted an important point in problem description. Can I send this file to you Phil |
All times are GMT +1. The time now is 01:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com