View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
slarbie slarbie is offline
external usenet poster
 
Posts: 53
Default excel crashing after deleting shapes

Thanks guys! I'll go off and play with this "aha!" moment that I need to
distinguish between the kinds of shapes I'm deleting. The sheet has a pivot
table and I'm thinking maybe some of the functional parts of the pivot were
getting deleted, like dropdown boxes for selecting fields. Then maybe trying
to save a crippled pivot table could get the application confused enough to
flip it out.

"Peter T" wrote:

Can't see an obvious reason why that code should cause Excel to crash
subsequently on saving. You could try simply -

ActiveSheet.DrawingObjects.Delete

I can only assume there is something else wrong with your file, other code,
or something particular about the shapes you are deleting. Any code in the
Workbook_BeforeSave event getting confused?

Regards,
Peter T


"slarbie" wrote in message
...
Recently I've had two different files crash my excel consistently under

these
conditions.
Used some code to copy sheets to a new workbook, then this segment:

Dim shp as Shape
For Each Shp In ActiveSheet.Shapes
Shp.Delete
Next Shp

After the sub ends and I try to save the new workbook, Excel is crashing
every time. One of the sheets I'm using this for has enough shapes on it
that I don't want to make a line naming each one to delete. How else can

I
skin this cat?