Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Help - Running a macro when closing print preview
I was wandering is it possible to run a macro when i close print previe
in Excel? If so how do i Do it ? Any Comments would be useful! Thanks Car Jone -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Help - Running a macro when closing print preview
No really - there is not afterprint event. You could intercept the print
request in the BeforePrint event, then cancel it and manage the printing/print preview with your code - then you could perform an action after it was completed. However, there isn't an easy way to determine if the request is to print or printpreview. Another approach might be to remove all the menu choices and shortcut keys to print/print preview and provide your own interface - but the ability to do print/print preview is embedded in several builtin dialogs. -- Regards, Tom Ogilvy "carljonesuk " wrote in message ... I was wandering is it possible to run a macro when i close print preview in Excel? If so how do i Do it ? Any Comments would be useful! Thanks Car Jones --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Help - Running a macro when closing print preview
Hi Car Jones,
Try this, Put below code into thisworkbook's codemodule. Private Sub Workbook_BeforePrint(Cancel As Boolean) Application.EnableEvents = False Cancel = True ActiveWindow.SelectedSheets.PrintPreview Application.EnableEvents = True 'write\call you macro here MsgBox "macro runs after print preview" End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Help - Running a macro when closing print preview
So anytime anyone prints it will just do a printpreview.
-- Regards, Tom Ogilvy "Shailesh Shah" wrote in message ... Hi Car Jones, Try this, Put below code into thisworkbook's codemodule. Private Sub Workbook_BeforePrint(Cancel As Boolean) Application.EnableEvents = False Cancel = True ActiveWindow.SelectedSheets.PrintPreview Application.EnableEvents = True 'write\call you macro here MsgBox "macro runs after print preview" End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro & Print Preview? | Excel Discussion (Misc queries) | |||
Auto running a macro on closing | Excel Discussion (Misc queries) | |||
Print Preview Macro | Excel Discussion (Misc queries) | |||
Closing the Userform when macro is running | Excel Programming | |||
Resuming code after closing a print preview | Excel Programming |