Results 1 to 3 of 3

Thread: Assign an event to chart on workbook open

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    You can do that with a code like this

    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
    where 'MyMacro' is the macro you want to assign...
    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

  2. #2
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    15
    Thanks for your Quick response.
    This forum is like dream come true for me.

    You can do that with a code like this

    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
    where 'MyMacro' is the macro you want to assign...
    It works for a single chart i need it for every chart on the workbook.

    Thanks again.
    Last edited by LalitPandey87; 02-20-2012 at 08:30 AM.

Similar Threads

  1. Open And Activate Workbook Before Runing Macro
    By Howardc in forum Excel Help
    Replies: 5
    Last Post: 06-04-2013, 07:23 PM
  2. Workbook Event running VBA question
    By jamilm in forum Excel Help
    Replies: 4
    Last Post: 12-29-2012, 12:12 AM
  3. VBA Code to Open Workbook and copy data
    By Howardc in forum Excel Help
    Replies: 16
    Last Post: 08-15-2012, 06:58 PM
  4. Replies: 8
    Last Post: 08-05-2012, 10:07 AM
  5. Get Name List of All Open Workbook Files
    By princ_wns in forum Excel Help
    Replies: 5
    Last Post: 04-07-2012, 12:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •