Looking to create a Batch file to open and Close Excel

I have a batch file that copies a file, then opens Excel, Excel runs vba code then closes the workbook, but leaves Excel open.

What is the cmd lline to quit an application and do I need some kind of pause in the batch file to allow for the vba code to run before quiting the applicaton.

echo Please wait. Installation in progress.
copy "\\server1\instr2\LEDR\Instr\LEDR_Instr.xls" /r "\\server1\instr2\LEDR\Instr\FTE-Instr WS.xls" /r
rem del "\\server1\instr2\LEDR\Instr\LEDRVis.txt"
start "msexcel.exe" "\\server1\instr2\LEDR\Instr\LEDR_NIGHTLY Processing.xls"
rem taskkill /f /im msexcel.exe
goto end

Open in new window

Karen SchaeferBI ANALYSTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.Commented:
You might have to use Kixtart to do that if there isn't anything in VBA to do what you want.


If you are interested look at the SendKeys function to close down the application.
I don't know of anything you can do in batch to kill an application.

Put the exit from Excel in your VBA script.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
what if you add /wait to the start command that launches Excel...it shouldn't run the taskill until excel returns control to the batch file...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.