Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Workbook_BeforePrint macro

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Workbook_BeforePrint macro

When you print preview, the entire macro will be run. If you don't want
something to run, either delete it or move it to another module where you'll
use it.

"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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Workbook_BeforePrint macro

Barb
I want the entire macro (it calls another macro) to run when the user
issues a print command. I take it then, from what you say, that there is no
way to detect that a Print Preview was commanded. Is that right? Thanks
for your time. Otto
"Barb Reinhardt" wrote in message
...
When you print preview, the entire macro will be run. If you don't want
something to run, either delete it or move it to another module where
you'll
use it.

"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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Workbook_BeforePrint macro

I'm not aware of it, but I've just recently started working with event driven
macros.

"Otto Moehrbach" wrote:

Barb
I want the entire macro (it calls another macro) to run when the user
issues a print command. I take it then, from what you say, that there is no
way to detect that a Print Preview was commanded. Is that right? Thanks
for your time. Otto
"Barb Reinhardt" wrote in message
...
When you print preview, the entire macro will be run. If you don't want
something to run, either delete it or move it to another module where
you'll
use it.

"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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Workbook_BeforePrint macro

Hi Otto,
I tried writing some code and crashed Excel.
Here are some other ways to possible do it ...
http://snipurl.com/13du9
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Otto Moehrbach"

wrote in message
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




  #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


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
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 12:32 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"