LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Workbook_BeforePrint macro

Hi Otto
I'm not too fluent in VBA (nor in english) but I had similar trouble i fixed
that way, thanks to code from Leo Heuser :

In TWK :
Private Sub Workbook_Open()
RedefinePrintPreview 'voir proc dans module1 de ce fichier
End Sub

And in a std module :
'=========dans un module standard
Public Preview As Boolean

Sub RedefinePrintPreview()
, May 2001
Dim CBar As CommandBar
Dim Found As CommandBarControl

For Each CBar In CommandBars
Set Found = CBar.FindControl(ID:=109, recursive:=True)
If Not Found Is Nothing Then
Found.OnAction = "Pre" ' Found.OnAction = "" for default

End If
Next CBar

Preview = False 'Not necessary but informative :-)

End Sub

Sub Pre()
Preview = True
ActiveSheet.PrintPreview
Preview = False
End Sub
'===========================
'===============
Sub ResetPrintPreview()
Dim CBar As CommandBar
Dim Found As CommandBarControl

For Each CBar In CommandBars
Set Found = CBar.FindControl(ID:=109, recursive:=True)
If Not Found Is Nothing Then
Found.OnAction = "" 'pour avoir le fonctt par défaut
End If
Next CBar

End Sub
'===========================

HTH
J@@

Otto Moehrbach wrote:
Excel XP & Win XP
When I click on File - Print Preview the Workbook_BeforePrint macro I have
fires. How can I have it not fire or what code can I put in the macro to
prevent execution of the rest of the code? Thanks for your time. Otto


 
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
Workbook_BeforePrint Wayne Excel Programming 2 February 7th 06 07:27 AM
Workbook_BeforePrint performs twice ? Peter[_21_] Excel Programming 3 November 29th 04 01:24 AM
disable print option, not Workbook_BeforePrint Andoni[_4_] Excel Programming 0 July 27th 04 11:40 PM
Workbook_BeforePrint Squid[_2_] Excel Programming 2 May 11th 04 04:18 PM
Problem - Workbook_BeforePrint JON-JON Excel Programming 3 August 26th 03 01:19 PM


All times are GMT +1. The time now is 10:49 AM.

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"