The chart window thing is a throwback to an ancient version of Excel,
probably the first version that allowed embedded charts in a worksheet. I'm
not surprised it misbehaves in VBA.
The event trap shouldn't care whether the sheets are newly added or original
equipment. What you might try is insert a DoEvents line after
EvtChart.ShowWindow. This allows Windows to catch up on its housekeeping,
and might let the chart window actually be created in time for you to set
its dimensions.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
"InfiniteJoy" wrote in message
oups.com...
I think I have found the real root of my problem...I have set up this
chart clicking code in a workbook that has only one worksheet (called
"MainMenu"). I use controls on that worksheet to allow a user to
select other workbooks whereby additional worksheets will be copied
into this workbook. Some of the new worksheets have the embedded
charts.
Upon merely copying the new worksheets into my workbook, the chart
clicking code results in the 1004 error I described above.
However, IF I SAVE THE WORKBOOK, then my chart clicking feature works
perfectly all of a sudden...so there seems to be some kind of
linking/updating going on within Excel during the saving.
Is this a bug? Or is there some explanation as to why existing event
trapping code might not apply to worksheets that have been newly copied
to my workbook?