Batch File Script Needed for running Excel

Posted on 2006-06-05
Last Modified: 2008-02-01

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.

Question by:mmemon
    1 Comment
    LVL 38

    Accepted Solution

    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:

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now