Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Since updating Office 2003 to 2007 Excel formulas do not work? | Excel Discussion (Misc queries) | |||
work book shrunk Office 2007 | New Users to Excel | |||
Since loading Office 2007 MSNstockquotes does not work ?? | Excel Discussion (Misc queries) | |||
Shadows don't work right in Office 2007? | Excel Discussion (Misc queries) | |||
does horizontal scroll work with office 2007? | Excel Discussion (Misc queries) |