ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Launching a DOS box from VBA (https://www.excelbanter.com/excel-programming/281913-launching-dos-box-vba.html)

David Dalebroux

Launching a DOS box from VBA
 
Windows 98, Excel 2002. Haven't a clue if this is possible!

As it stands now, a legacy DOS program runs its course in a window,
then the window closes when it's done.

I am in the process of eliminating this program. There is quite a bit
of data, and I can only retrieve one item at a time without having to
restart the DOS program.

1) Can I start a DOS Window from VBA...
2) ...and if so, can I check to see the state of the DOS window (ie,
is it active, does it have the focus, is still open, even is it
minimized, and even ensure there's only one instance running)?

No need to answer this next part, but if I am asking a simple question
in the first place....

What I am dreaming about is cranking up a macro, launching the DOS
window with the right parameter, pipe the output of the batch file
into the spreadsheet, check to see if the windows open, and if so,
kill it, then loop all over again. Once I gather the data, I put it
into a real application, (i.e., DATABASE).

God help me.

Tom Ogilvy

Launching a DOS box from VBA
 
The shell command can be used to start your executable (and will open a
window)

http://support.microsoft.com/?id=214248
XL2000: How to Force Macro Code to Wait for Outside Procedure

http://support.microsoft.com/?id=129796
HOWTO: 32-Bit App Can Determine When a Shelled Process Ends

http://support.microsoft.com/?id=147392
XL: How to Force Macro Code to Wait for Outside Procedure

http://support.microsoft.com/default...b;en-us;147659
HOWTO: Get a Window Handle Without Specifying an Exact Title


--
Regards,
Tom Ogilvy


David Dalebroux wrote in message
om...
Windows 98, Excel 2002. Haven't a clue if this is possible!

As it stands now, a legacy DOS program runs its course in a window,
then the window closes when it's done.

I am in the process of eliminating this program. There is quite a bit
of data, and I can only retrieve one item at a time without having to
restart the DOS program.

1) Can I start a DOS Window from VBA...
2) ...and if so, can I check to see the state of the DOS window (ie,
is it active, does it have the focus, is still open, even is it
minimized, and even ensure there's only one instance running)?

No need to answer this next part, but if I am asking a simple question
in the first place....

What I am dreaming about is cranking up a macro, launching the DOS
window with the right parameter, pipe the output of the batch file
into the spreadsheet, check to see if the windows open, and if so,
kill it, then loop all over again. Once I gather the data, I put it
into a real application, (i.e., DATABASE).

God help me.




David Dalebroux

Launching a DOS box from VBA
 
This article is perfect -- http://support.microsoft.com/?id=147392
(XL: How to Force Macro Code to Wait for Outside Procedure)

I guess I just didn't know what to query on! Thank you for your
assistance!


All times are GMT +1. The time now is 09:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com