You can do that with a code like this
where 'MyMacro' is the macro you want to assign...Code:Private Sub Workbook_Open() Worksheets(1).Shapes(1).OnAction = "MyMacro" 'Replace the indices with the name of the worksheet and the chartobject End Sub
You can do that with a code like this
where 'MyMacro' is the macro you want to assign...Code:Private Sub Workbook_Open() Worksheets(1).Shapes(1).OnAction = "MyMacro" 'Replace the indices with the name of the worksheet and the chartobject End Sub
A dream is not something you see when you are asleep, but something you strive for when you are awake.
It's usually a bad idea to say that something can't be done.
The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve
Join us at Facebook
Thanks for your Quick response.
This forum is like dream come true for me.
It works for a single chart i need it for every chart on the workbook.You can do that with a code like this
where 'MyMacro' is the macro you want to assign...Code:Private Sub Workbook_Open() Worksheets(1).Shapes(1).OnAction = "MyMacro" 'Replace the indices with the name of the worksheet and the chartobject End Sub
Thanks again.
Last edited by LalitPandey87; 02-20-2012 at 08:30 AM.
Bookmarks