Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RPW RPW is offline
external usenet poster
 
Posts: 52
Default PrintPreview in 2007 (for what it's worth...)

Hi all,

I just figured something out and wanted to share this with you.

Maybe it is common knowledge that your macros will run quicker if you turn
off screen updating (Application.ScreenUpdating = False), I don't know, but
be careful how/when you use it in conjunction with the PrintPreview method in
Excel 2007.

I have an application that runs several row height changes and row hiding
events in loops on a hidden sheet so I had the screen updating turned off
until the macro was finished running. Near the end of the macro I use the
PrintPreview method to reveal the hidden sheet so the user can view what the
end product looks like and then print it if so desired (without having to
unhide the protected sheet). This worked fine in XP / 2003. However, in
2007 there was no way for the user to print from this preview.

I tinkered with the code for a while and ending up discovering that if
screen updating is set to 'True' just prior to the PrintPreview method and
set back to 'False' immediately afterwards then I would get a normal print
preview where the user could access the print command. Unfortunately in 2007
there is a flash of the hidden sheet just prior to the preview and again just
after the preview. The hidden sheet was never seen (except in preview) in
2003/XP. No very slick looking now...

If you have 2007, you might paste the two simple samples below into a module
to see the difference I'm describing. You will want to setup a couple of
command button to trigger the macros and also make sure there is at least one
entry in the cells of Sheet1 so there is something to print.

Sub PrintPreviewPrint()
Worksheets("Sheet1").PrintPreview
End Sub

Sub PrintPreviewOnly()
Application.ScreenUpdating = False
Worksheets("Sheet1").PrintPreview
Application.ScreenUpdating = True
End Sub

--
rpw
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
PrintPreview Gerry Verschuuren Excel Discussion (Misc queries) 5 October 23rd 07 06:24 PM
.PrintPreview André Boileau Excel Programming 2 February 9th 07 02:31 AM
.PrintPreview ONLY Page 1 Corey Excel Programming 1 January 12th 07 03:37 AM
Is this worth a try anjgoss Excel Programming 2 September 17th 05 05:14 AM
printpreview Alex Excel Programming 5 September 12th 05 10:26 PM


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