Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbook_BeforePrint and Print Preview 3

Status
Not open for further replies.

DrSimon

IS-IT--Management
Dec 14, 2001
674
GB

A closed earlier thread (thread707-1438142) discussed the use of BeforePrint with Print Preview. It seems that it used to work with Print Preview, but I have found that it doesn't seem to be invoked with Excel 2010. Has anyone found a way round this? I am using BeforePrint to update the header with data and it will only update once I actually print.

Thanks
Simon
 
Hi,

And your code is...

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip
It really doesn't matter what the code is - it just doesn't get called. The following only displays a message when I actually print (to physical printer or file), not when I do Print Preview without printing. 2010 seems to be different in the way that Print Preview works which may well account for it.

Code:
 Private Sub Workbook_BeforePrint(Cancel As Boolean)    
   MsgBox "Workbook_BeforePrint called"
Exit Sub

I would nice to know if there is a way round it. As it happens I've realised that I can get round my current problem by using Worksheet_SelectionChange as the trigger in this case.

Simon
 
Do you have a macro enabled workbook? .xlsm or .xlsb [red]NOT .xlsx[/red]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip - it doesn't make any difference, but good thought.
combo - that's the answer - Print Preview Full Screen is what is needed!

Many Thanks
Simon
 
Thanks combo for that link; the author Debra made a very comprehensive and easy to understand example of how to remedy the problem.

sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top