Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem looping ChartObjects in a Com-dll

My app loops all ChartObjects on a sheet two or more times. The first loop
reads a few properties for a few pre-checks and runs fine. The second loop
reads a lot more chart properties and makes changes to charts.

In the second loop when it get to setting a ref to the second chartobject
things go seriously wrong, typically with error no / description:
-2147417848 / Method '~' of object '~' failed

Stepping through -
For i = 1 to xlApp.ActiveSheet.ChartObjects.count
Set cht = xlApp.ActiveSheet.ChartObjects(i) ' i = 2

Looking at cht in locals most of the properties are not accessible (though a
small number are such as Name).

Everything is error handled and I can get back to my form and quit the app.
However when I next try and select a chart Excel crashes!

What's odd is this problem only occurs when the dll is run as a Com AND if
no charts had ever been selected on the sheet since the workbook was opened.
Had I first selected a chart (object) everything runs fine, whether or not a
chart was selected while running the app.

The same dll can be run as an Active-X. With this method there are no
problems at all! The only significant difference between running as a Com or
Active-X is how the app starts. As a Com it starts from the 'hooked' click
event of an Excel menu button. As an Active-X vba instanciates an entry
class in the dll which has a public proc' to set a ref to Excel and run the
app.

I doubt anyone can recreate this problem but wonder if anyone has come
across something similar or can shed any light.

Regards,
Peter T


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
looping through chartobjects returns deleted charts also Rolf Barbakken[_3_] Excel Programming 2 January 12th 06 01:19 PM
Looping Problem Paul Black Excel Programming 3 September 17th 05 09:59 AM
Looping problem Sleeping Bear Excel Programming 2 July 7th 05 07:41 PM
Looping Through Charts / ChartObjects William Benson[_2_] Excel Programming 2 June 29th 05 01:47 AM
Looping Problem Todd Huttenstine[_3_] Excel Programming 5 January 25th 04 12:51 AM


All times are GMT +1. The time now is 06:02 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"