Run a macro from a .bat

0

I wanted to know if it is possible to run a macro in Excel from a .bat file

since I can not find a way to do it.

The macro that I own works correctly but I need it to run when I run the .bat

I would appreciate it if you know something, you can guide me.

Thanks for your time.

Greetings

    
asked by Sebastian Quijada 18.12.2018 в 17:43
source

1 answer

1

You have to take the following steps:

  • In your .xlsm file you should review your macros and double click on the ThisWorkbook element and place the following event Private Sub Workbook_Open ()
  • Example:

    Private Sub Workbook_Open()
    MsgBox "Good Morning"
    Call Macro1
    End Sub
    
  • Create a .bat that calls your Excel file:

    start Excel.exe Book1.xlsm

  • With that I should reach.

    Discuss how it went.

    Greetings!

        
    answered by 18.12.2018 в 19:55