ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code execution interrupted on PrintPreview close (https://www.excelbanter.com/excel-programming/342876-code-execution-interrupted-printpreview-close.html)

AusTexRich

Code execution interrupted on PrintPreview close
 
The macro works fine up to the print preview. When I Close from the toolbar
I get the message "Code execution has been interrupted".
What can I add to the macro to prevent the interruption?

Here's the code from the macro

Sub PPreview()

ActiveWindow.FreezePanes = False
ActiveSheet.PageSetup.PrintArea = "PRT_G1"
ActiveWindow.SelectedSheets.PrintPreview
End Sub
--
AusTexRich

Dave Peterson

Code execution interrupted on PrintPreview close
 
It didn't blow up for me (xl2003), but I have seen things like this cause
trouble--but I remember them happening when I'm stepping through the code--not
when I really run it. Am I mis-remembering?

And I don't think that there's anything you can do to stop that--so save your
work often.

Ps. From John Walkenbach's site:
http://j-walk.com/ss/excel/odd/odd11.htm

AusTexRich wrote:

The macro works fine up to the print preview. When I Close from the toolbar
I get the message "Code execution has been interrupted".
What can I add to the macro to prevent the interruption?

Here's the code from the macro

Sub PPreview()

ActiveWindow.FreezePanes = False
ActiveSheet.PageSetup.PrintArea = "PRT_G1"
ActiveWindow.SelectedSheets.PrintPreview
End Sub
--
AusTexRich


--

Dave Peterson


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com