I have two excel files, C:\A.xlsm and C:\B.xlsm, both have macros defined in "Workbook_Open()", when opened, will run, make some computation, then exit.

Is it possible to use command line, batch file, etc, to run the two excel files, in sequence?

By run, I mean B shall start after A finish.

I understand that Windows Scheduled Task can define multiple Actions, which will start in sequence, but the next action doesn't wait the previous one to finish. So this is not enough here.

  • In your macro in first file put the last statement (before exiting) as Shell ("cmd /c C:\B.xlsm") – patkim Mar 1 '17 at 1:36
  • @pat2015 true, that would work. but really would rather not go this way creating hidden dependencies unless there's no other way out. – athos Mar 1 '17 at 1:43
  • Would a batch file with cmd /c C:\A.xlsm followed by cmd /c C:\B.xlsm not do what you need? – txtechhelp Mar 1 '17 at 2:01

Try this batch file

start /wait excel.exe a.xlsx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.