Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Resetting an object counter

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Resetting an object counter

Hi Tom,

Indeed that object counter increments whenever any kind of object is
inserted on the sheet. The only way I know to reset is to remove ALL objects
from the sheet and save (possibly also need to close & re-open).

I am not aware of any problems with a very high object counter, I've never
experienced any even with the counter at many 100k's. Ultimately I guess
there must be a limit before it reaches infinity!

Regards,
Peter T

"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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Resetting an object counter


"Peter T" <peter_t@discussions wrote in message
...
Hi Tom,

Indeed that object counter increments whenever any kind of object is
inserted on the sheet. The only way I know to reset is to remove ALL

objects
from the sheet and save (possibly also need to close & re-open).

I am not aware of any problems with a very high object counter, I've never
experienced any even with the counter at many 100k's. Ultimately I guess
there must be a limit before it reaches infinity!

Regards,
Peter T

"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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Resetting an object counter

I didn't read your question properly re adding shapes to a chartobject. The
chart has it's own counter but I don't think that can be reset, apart of
course from deleting the chart (but no need to delete other objects).

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
Hi Tom,

Indeed that object counter increments whenever any kind of object is
inserted on the sheet. The only way I know to reset is to remove ALL

objects
from the sheet and save (possibly also need to close & re-open).

I am not aware of any problems with a very high object counter, I've never
experienced any even with the counter at many 100k's. Ultimately I guess
there must be a limit before it reaches infinity!

Regards,
Peter T

"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







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Resetting an object counter

Just for the hell of it, I ran the following code

Dim WS As Worksheet
Dim SH As Shape
Dim N As Long
Set WS = ActiveSheet
Do Until Err.Number < 0
N = N + 1
Set SH = WS.Shapes.AddLine(0, 0, 0, 0)
SH.Delete
Loop

for a while before breaking out of it.

It got up to about 180,000 before I got bored and broke out of the code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Resetting an object counter

Dear Folks,

Thanks for all your great comments!! Very helpful!

Tom

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resetting Defaults jnix Setting up and Configuration of Excel 1 August 12th 09 10:29 PM
ActiveRange not resetting [email protected][_2_] Excel Programming 2 April 19th 06 02:42 AM
Resetting cells Sony[_3_] Excel Programming 5 February 4th 04 03:31 PM
Resetting a variable to nothing Todd Huttenstine[_3_] Excel Programming 4 January 27th 04 12:06 PM
Resetting variables TBA[_2_] Excel Programming 3 December 18th 03 03:44 AM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"