run a macro on other workbook

  • I have a couple of workbooks...book1,book2 etc.. each with macros. The macro in Book1 analyze certain type of test files, Book2 will analyze some other test files....
    There is a command button in all the workbooks...clicking it will excecute the macros.

    I want to create a macro in a "main workbook'"...this macro will open book1, click the command button. Once macro in Book1 is done, the macro in "main workbook" will open book2 and click the commad button in book2... and son on.

    How to implement the command button click in the "Main workbook" macro?

    Appreciate your help.

  • Re: run a macro on other workbook

    If I was doing this I'd have the MACRO running from the master workbook, You would then know when it's finished and be able to run both MACRO's easily in succession.

    I don't know how to call a MACRO from another workbook!


    Good Luck!

    Ray :nana:

  • Re: run a macro on other workbook

    What i am getting at is that the macros you want to all are in different books as so causing the problems You are requesting to make a "main workbook'"... this is ok and if you pack one workbook with all the required code then make that workbook into a xla [add in] so you can call and run as required, this can be against the active workbook or You can name the workbook for the code to run against , very much a choice how you want to run, normally i will make to 'active workbook', care is needed to make sure You are running and working in the correct workbook before code is execute else You could / will mess Your work up and reversing VBA actins is generally impossible

    I can not help more than this as i can not see Your codes, it will take a rigid structure and cleaver codes but if You have the codes done them all You need to do is convert them and how he run and when, the xla route is best as long as others do not need to use and run the codes as them will not be able to unless You give a copy of the xa.

    A good start would be to search OzGrid for xla and add ins there’s a lot of information, when Your ready and have clear ideas and need help please post back.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!