View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Resetting an object counter

Fwiw, Tom, in all my years hanging here I've never heard of anyone hitting
any kind of limitation with regard to this counter. I think if this is your
biggest concern, you're in great shape!<g.

--
Jim
"kreutz" wrote in message
oups.com...
I've written a VB routine to create a custom chart in which rectangles
are placed at many different X-Y locations. With each new batch of
data, I first erase the old rectangles via:

For n = ActiveChart.Shapes.Count To 1 Step -1
ActiveChart.Shapes.Range(Array(n)).Delete
Next n

However, Excel clearly retains some memory of my previous work because,
if I select a given rectangle (e.g. while recording a macro), I get
code that looks like:

ActiveChart.Shapes("Rectangle 3163").Select

Apparently, I have already plotted and erased over 3000 rectangles!

I'm worried about overflowing this rectangle object counter, and
inadvertently destroying my workbook's ability to function. Does
anyone know if there is a way to reset this counter, or if its maximum
size is so large that I needn't worry about it? (I probably won't
exceed 100,000 rectangles over the life of the workbook.)

Many thanks, and Happy Holidays!

Tom Kreutz