automation error kills excel

S

Simon Prince

Hi,
I'm writing an excel application that essentially loads and parses a
text file into a spreadsheet. The data in the spreadsheet is later
used to generate a number of drawings on blank excel charts. When I
start to include text-box shapes on the charts I get the following
error messages.

"Run-time error '-2147417848 (80010108)':
Method 'Name' of object 'Shape' failed

Click Debug

Run-time error '-2147417848 (80010108)':
Automation error
The object invoked has disconnected from its clients.

Click Debug

Excel - Application error
The instruction at "0x650215cd" refereced memory at "0x6575c089". The
memory could not be read

At this point excel wipes out. A snippet of the code where it dies
is....

....
Dim ourchart As Chart
Dim shp As Shape
Dim chartnum As Integer, loop1 As Integer

Set ourchart = ActiveChart
For Each shp In ourchart.Shapes
If Left(shp.name, 4) = "LINE" Then shp.Delete <- Failure
point
Next

....

Unfortunately, the errors occur randomly during the drawing process.
When an event is generated by the user, the drawing subroutine deletes
and redraws everything.

So, any suggestions? I've been wondering about the delete/redraw
process. Is it possible that excel doesn't clean up properly and
'loses track' eventually when new shapes are added with the same names
as those just deleted. The problem occurs on 2 different machines,
one with windows 2000/office 2000, and the other XPhome, XP office.

One final observation. This problem really only occurs when I start
inserting a lot of textbox shapes.

Thanks for any help.


Simon
 
S

Simon Prince

bdcrisp said:
do you get errors while imputting and parsing the text file?

Occasionally... however it turned out that the code snippet I posted
had quite a lot to do with it. For speed reasons I decided to rewrite
parts of the code and avoid looping through all the shapes to see if I
wanted to delete them. I suspect that deleting a shape whilst in the
middle of a "for each shp in shapes" causes memory problems in excel
somewhere.

Thanks,

Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top