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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default 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
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
modification to this code James Excel Discussion (Misc queries) 0 March 23rd 09 09:20 PM
Code modification help AndyMP Excel Worksheet Functions 1 February 8th 09 11:41 PM
Can I adjust print scaling for multiple print areas on the same sh N. Sammons Excel Discussion (Misc queries) 0 June 18th 08 10:24 PM
Need to print a workbook but worksheets have diff print areas Angela Steele Excel Discussion (Misc queries) 1 January 17th 08 07:39 PM
Modification to code Peter Atherton Excel Programming 1 September 23rd 03 07:36 PM


All times are GMT +1. The time now is 02:20 PM.

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

About Us

"It's about Microsoft Excel"