?
Solved

Batch File Script Needed for running Excel

Posted on 2006-06-05
3
Medium Priority
?
967 Views
Last Modified: 2008-02-01
Hello,

I want to create a batch file that will run a .dqy file in excel and save.

My problem is when I run the script I have, it opens the file in excel but the query takes a few seconds to run so the new saved file gets created with no data before the query runs.

"C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\CurrentDietOrders.dqy"  > C:\SNH_CurrentDietOrders.xls

I tried a pause command but that doesn't seem to work. All I want to do is run the dqy file and save it in a directory for a department to retrieve.

Help,
Michele
0
Comment
Question by:mmemon
1 Comment
 
LVL 38

Accepted Solution

by:
Shift-3 earned 400 total points
ID: 16835022
I believe the problem isn't with the delay in running the query.  It is that redirection (>) only captures the output of the command itself, which in this case is blank.  To get Excel to save a whole new sheet you will need a different approach.

One I think would work would be to create a new spreadsheet with an auto-run macro that will open the .dgy file, save it under the desired name, and then close Excel.  Most of the steps can probably be captured by going to Tools|Macro|Record New Macro.

Instructions on making the macro auto-run are here: http://www.ozgrid.com/VBA/auto-run-macros.htm
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Progress

850 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