embedded chart events, module confusion

Showard27

Board Regular
Joined
Sep 5, 2005
Messages
155
Hi all

I am confusing myself over where code needs to sit, and standard versus class modules.

I have an embedded bar chart, that needs to run a macro when any of the bars are selected. when this was a chart sheet it worked fine, but I can seem to get it working as an embedded chart.

Currently my class module looks like this:

Code:
Public WithEvents mychartclass As Chart

Private Sub mychartclass_Select(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long)
      Application.Run "MFChart"
      MsgBox "Success"
End Sub
In the Thisworkbook code:
Code:
Private Sub Workbook_Open()
      Application.Run "InitialiseChart"
End Sub
and in a standard module:
Code:
Sub InitialiseChart()
    Set myClassModule.mychartclass = Worksheets("Standards").ChartObjects(2).Chart
End Sub
what am i doing wrong, have i got something in the wrong place ?

Many thanks for any help or guidance. Excel 2003 by the way.

Simon
 
Hi

I have an old installation of excel 2000 at home and I will try the code during the weekend. If I get the same problem, then maybe it's some excel problem that was solved in the meantime.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top