Rectangle 27 0

You can open an excel file from a batch script and run a macro whenever the excel file is opened, but whatever you are trying to do will probably be done better if it is not done with a macro

excel vba - Calling macro in a batch script - Stack Overflow

excel-vba batch-processing
Rectangle 27 0

Use a VBS script to open an instance of excel and then you can load the file and run the macro/function you're interested in. This should offer you all the control you need from what you have described.

excel vba - Calling specific module in Vba from batch script - Stack O...

vba excel-vba batch-file
Rectangle 27 0

Dim xlApp
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = true
xlApp.Application.Workbooks.Open ("C:\folders\file name.xlsm")
xlApp.Application.Run ("'file name.xlsm'!MacroName")

vba - .acsauto script to open Excel application and call macro - Stack...

excel vba vbscript avaya