Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default macro does not work in Office 2007... suggestions:

i had the following macro that worked in Office 2003, but in Office 2007 it
does not work. It prevents the print job once only, but the user can just
press the print again and it prints...

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "DSR" Then
Cancel = True
Application.EnableEvents = False
With ActiveSheet
If .Range("d1") < "[Ctrl] ;" And Range("d57") = 0# And
Range("d5") < 0# Then
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Call Mail
End If
End With
End If
End Sub

any suggestions to help prevent the print job would be appreciated.

thank you,

jat
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,549
Default macro does not work in Office 2007... suggestions:


It didn't work in XL2003 either.
What you have is an "Event" sub.
If XL is told to ignore events then all event subs are inoperative.
That instruction remains in effect until XL is told to recognize events again or XL is restarted.
Check out "EnableEvents" in VBA help.
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"jatman"
wrote in message
i had the following macro that worked in Office 2003, but in Office 2007 it
does not work. It prevents the print job once only, but the user can just
press the print again and it prints...

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "DSR" Then
Cancel = True
Application.EnableEvents = False
With ActiveSheet
If .Range("d1") < "[Ctrl] ;" And Range("d57") = 0# And
Range("d5") < 0# Then
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Call Mail
End If
End With
End If
End Sub

any suggestions to help prevent the print job would be appreciated.
thank you,
jat
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default macro does not work in Office 2007... suggestions:

Before the last End If, insert this line:

Application.EnableEvents = True

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"jatman" wrote in message
...
i had the following macro that worked in Office 2003, but in Office 2007 it
does not work. It prevents the print job once only, but the user can just
press the print again and it prints...

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "DSR" Then
Cancel = True
Application.EnableEvents = False
With ActiveSheet
If .Range("d1") < "[Ctrl] ;" And Range("d57") = 0# And
Range("d5") < 0# Then
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Call Mail
End If
End With
End If
End Sub

any suggestions to help prevent the print job would be appreciated.

thank you,

jat



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
Since updating Office 2003 to 2007 Excel formulas do not work? Pheasant Plucker® Excel Discussion (Misc queries) 2 January 26th 08 02:11 PM
work book shrunk Office 2007 Barry New Users to Excel 1 January 13th 08 06:24 AM
Since loading Office 2007 MSNstockquotes does not work ?? RolloBurgess Excel Discussion (Misc queries) 7 June 5th 07 01:27 AM
Shadows don't work right in Office 2007? Jaimie Excel Discussion (Misc queries) 1 May 1st 07 10:53 PM
does horizontal scroll work with office 2007? obidon Excel Discussion (Misc queries) 1 July 31st 06 02:36 PM


All times are GMT +1. The time now is 06:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"