Search code examples
mysqlexcelvbaalm

How to call an Excel report from an other Excel report?


I have 12 Excel reports in my Application Lifecycle Management. Each of them execute a Query and some VBA code when I click on generate.

I was wondering if it is possible to create a single Excel report that can call each of the previously mentioned reports so that I don’t have to manually generate each of them. Is there a way?

Otherwise I think I’ll have to regroup and recode them in one big Excel report, which would not be practical for future modifications.


Solution

  • You can call macro from "starting file". You need open file, start makro like bellow, close file and do the same with another

    Application.Run "filename.xlsm!macroname"
    

    EDIT:

        sub test()
            Workbooks.Open filepath & "\filename.xlsm"
            Application.Run "filename.xlsm!macroname"
            Windows(ActiveWorkbook.Name).Close
        end sub