LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Control printing?

Cool, so the basic idea is to process "Workbook_BeforePrint()"
and set the page setup ".PrintArea".

Thank you Claus! 8)


"Claus Busch" wrote in message
...
Hi Robert,

Am Fri, 25 Jan 2013 11:54:27 -0700 schrieb Robert Crandal:

Whenever a user presses 'Print' (or even Ctrl-P), Excel will
automatically
print all 10 pages. This will often waste paper, because what if a user
only fills up 2 pages with data? That means the remaining 8 empty pages
get printed as well.


set print area new for each print job:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim LRow As Long
Dim LCol As Integer

With ActiveSheet
LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
LCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
With .PageSetup
.PrintArea = ""
.PrintArea = "$A$1:" & Cells(LRow, LCol).Address
End With
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


 
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
Printing from a control button Dave Peterson Excel Programming 4 December 30th 09 01:59 AM
Printing Control VoxBox-Richard Excel Programming 4 October 9th 08 06:47 PM
Get Control Before AND After Printing pwrichcreek Excel Programming 1 March 8th 07 08:36 PM
Get Control Before AND After Printing pwrichcreek Excel Programming 3 March 8th 07 08:14 PM
My spreadsheet has a control box. box moves after printing. Why? BellExcel Excel Discussion (Misc queries) 2 May 21st 05 12:23 AM


All times are GMT +1. The time now is 10:17 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"