Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Looking to create a Batch file to open and Close Excel

Posted on 2008-11-14
3
Medium Priority
?
557 Views
Last Modified: 2012-05-05
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.

Karen
echo Please wait. Installation in progress.
echo DO NOT CLOSE THIS WINDOW. 
echo IT WILL CLOSE AUTOMATICALLY WHEN FINISHED.
 
 
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
 
:end

Open in new window

0
Comment
Question by:Karen Schaefer
3 Comments
 
LVL 50

Expert Comment

by:dbrunton
ID: 22969872
You might have to use Kixtart to do that if there isn't anything in VBA to do what you want.

http://www.kixtart.org/manual/

If you are interested look at the SendKeys function to close down the application.
0
 
LVL 5

Accepted Solution

by:
PaulKeating earned 2000 total points
ID: 22971422
I don't know of anything you can do in batch to kill an application.

Put the exit from Excel in your VBA script.
0
 
LVL 9

Expert Comment

by:dlb6597
ID: 22988195
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...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question