F
Fred Russell
I'm using VBA to draw 4 charts to a worksheet that I add to the project
using:
ActiveSheet.ChartObjects.Add
After this happens there is a SUB on the ActiveSheet to change the size of
each of the 4 charts by clicking on a chart - expands/retracts the chart
size to show all 4 charts or just 1 chart enlarged.
The problem lies in setting the Chart1_Click SUB to the chart with:
ActiveSheet.Shapes(1).OnAction = "Sheet1.Chart1_Click"
If I add this code to the end of the chart draw routine, the routine goes
into an endless loop. I believe this is because the ActiveSheet and charts
are not drawn at that point in time - it doesn't exist yet. If I add the
OnAction assignment to the ActiveSheet SUB WorkSheet_Activate it works fine
but not before selecting another worksheet, then returning to activate the
chart worksheet. This latter solution sucks! I've tried adding a 10 second
delay but it still won't work properly.
Is this a case for writing a class macro to record the event of the chart
sheet reaching completion? I've never been there before. Help!
What's the best way to solve this problem?
Best regards,
Fred
using:
ActiveSheet.ChartObjects.Add
After this happens there is a SUB on the ActiveSheet to change the size of
each of the 4 charts by clicking on a chart - expands/retracts the chart
size to show all 4 charts or just 1 chart enlarged.
The problem lies in setting the Chart1_Click SUB to the chart with:
ActiveSheet.Shapes(1).OnAction = "Sheet1.Chart1_Click"
If I add this code to the end of the chart draw routine, the routine goes
into an endless loop. I believe this is because the ActiveSheet and charts
are not drawn at that point in time - it doesn't exist yet. If I add the
OnAction assignment to the ActiveSheet SUB WorkSheet_Activate it works fine
but not before selecting another worksheet, then returning to activate the
chart worksheet. This latter solution sucks! I've tried adding a 10 second
delay but it still won't work properly.
Is this a case for writing a class macro to record the event of the chart
sheet reaching completion? I've never been there before. Help!
What's the best way to solve this problem?
Best regards,
Fred