View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default Out of Control File Size

Glad you figured out the code. And the reason for the ever growing file size.

I did something like that some years ago, but with control buttons on a
worksheet - code kept adding more on top of older ones until it finally
crashed the (Excel 97) application due to lack of system resources. It took
me some time to figure out just what the hell I'd done to it all.

"Dawg House Inc" wrote:

An update on the solution - the sample below will delete all Rectangles,
Lines and Pictures on all sheets in a given workbook. To delete other object
types, simply add a line within the do loop like this:
Sheets(i).<objectname.Delete

Good luck.
JCH
~~~

Sub Delete_All_Objects()
Dim i, j As Integer
j = Sheets.Count
i = 1
Do Until i j
Sheets(i).Rectangles.Delete
Sheets(i).Lines.Delete
Sheets(i).Pictures.Delete
i = i + 1
Loop

End Sub
--
Dawg House Inc.
"We live in it, therefore, we know it!"