ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Preview Causes Crash (https://www.excelbanter.com/excel-programming/281651-print-preview-causes-crash.html)

RobNew[_2_]

Print Preview Causes Crash
 
Off'97
I have a VBA macro that calculates values from several sheets and and
updates a summary sheet (basically a template but is left as an "XLS" for a
variety of reasons). On the summary sheet there is a command button that
calls a routine to create a new workbook and copy some selected sheets as
well as the summary sheet to that book.
Because I wanted to remove the button from the copied summary sheet I did it
by

NewBk.Worksheets("Summary").Shapes("cbSaveStmnt"). Select
Selection.Cut

Immediately after this code I save the new workbook with a new name (Year
and month).

All is well, except, if I do a print preview on the displayed summary sheet
(the last sheet copied) Xl goes "boom" and tells me it was referencing a
memory location that couldn't be read.

I played with it and found that if I selected another sheet in the same book
and immediately re-selected the summary it was ok on a preview.
Further, if I rem'd out the button cut statement it was ok.

Incidentally (or maybe not so incidental), the whole project was created
between Off 2000 and '97. It will be installed on a '97 m/c.

I can't seem to duplicate the problem on 2000 (is there some sort of
conflict between the two versions?)

Any ideas?

--
Regards;
Rob

Please reply to the NG.
I'm already up to my eyeballs in
Nigerian/South African get rich
letters as well as "Microsoft Critical Updates" et al.




All times are GMT +1. The time now is 08:20 PM.

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