View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Shailesh Shah[_2_] Shailesh Shah[_2_] is offline
external usenet poster
 
Posts: 114
Default 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!