Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Macro & Print Preview? Ken Excel Discussion (Misc queries) 2 April 2nd 08 12:52 PM
Auto running a macro on closing Jimmy D Excel Discussion (Misc queries) 6 November 22nd 07 01:58 AM
Print Preview Macro Emanuel Violante Excel Discussion (Misc queries) 1 June 2nd 06 11:28 AM
Closing the Userform when macro is running SuperJas Excel Programming 5 December 10th 03 05:31 AM
Resuming code after closing a print preview DarrenW Excel Programming 1 July 21st 03 02:54 PM


All times are GMT +1. The time now is 10:02 PM.

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"