Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Positioning a DOS Window

Greetings !

I currently have this-
--------------------------------------------
Open "C:\Runner.bat" For Output As #1
Print #1, "@ECHO off"
Print #1, "Echo Please wait -"
Print #1, "Echo This may take some time ...."
Print #1, " [ other DOS commands ] ."
Close

Shell "C:\Runner.bat", vbNormalFocus

MsgBox "Please wait " & vbCrLf & _
"until the DOS window closes."

Kill "C:\Runner.bat"
----------------------------------------------

The reason for the MsgBox
is to prevent VBA from KILLing the batch file
until it has completed running.

I would like the DOS window to cover the MsgBox.

How can I specify whereabouts on the screen
the DOS window will appear?


RClay AT haswell DOT com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Positioning a DOS Window

I don't know a way of positioning the DOS window, but you could stop it from
closing:

Shell Environ("comspec") & " /k c:\runner.bat", vbNormalFocus

/c (instead of /k) will close the window

Robin Clay wrote:

Greetings !

I currently have this-
--------------------------------------------
Open "C:\Runner.bat" For Output As #1
Print #1, "@ECHO off"
Print #1, "Echo Please wait -"
Print #1, "Echo This may take some time ...."
Print #1, " [ other DOS commands ] ."
Close

Shell "C:\Runner.bat", vbNormalFocus

MsgBox "Please wait " & vbCrLf & _
"until the DOS window closes."

Kill "C:\Runner.bat"
----------------------------------------------

The reason for the MsgBox
is to prevent VBA from KILLing the batch file
until it has completed running.

I would like the DOS window to cover the MsgBox.

How can I specify whereabouts on the screen
the DOS window will appear?

RClay AT haswell DOT com


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Positioning a DOS Window


Thank you for the suggestion - but acksherley....
VBA shells out to run a batch file
that takes several minutes to run.

Meanwhile, VBA continues,
and the next thing it does
is to kill the batch file -
but that is still running !


So I have inserted a MsgBox -
but if the user sees this,
she may be temopted to click OK...

So I wanted the DOS window to hide
the MsgBox until the batch file
has finished running.

Then the DOS window closes,
and the user may then click OK
to let VBA continue.

So I actually want the DOS window
to close on completion.


But what I was seeking
was a way to ensure
that the DOS window
covered the MsgBox.


Thanks again.


-----Original Message-----
I don't know a way of positioning the DOS window,
but you could stop it from closing:

Shell Environ("comspec") & _
" /k c:\runner.bat", vbNormalFocus

/c (instead of /k) will close the window

Robin Clay wrote:

Greetings !

I currently have this-
--------------------------------------------
Open "C:\Runner.bat" For Output As #1
Print #1, "@ECHO off"
Print #1, "Echo Please wait -"
Print #1, "Echo This may take some time ...."
Print #1, " [ other DOS commands ] ."
Close

Shell "C:\Runner.bat", vbNormalFocus

MsgBox "Please wait " & vbCrLf & _
"until the DOS window closes."

Kill "C:\Runner.bat"
----------------------------------------------

The reason for the MsgBox
is to prevent VBA from KILLing the batch file
until it has completed running.

I would like the DOS window to cover the MsgBox.

How can I specify whereabouts on the screen
the DOS window will appear?

RClay AT haswell DOT com


--

Dave Peterson

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Positioning a DOS Window

Thought i had it but no coffee in the system yet.....

Hmm... although this might work...

What if you made a user form that uses the onload event to run the do
window? that way you can bring up the form and then show the dos windo
in front just by using vbnormalfocus...

Off to put the kettle on now...

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Positioning a DOS Window

Do you want to have your code wait for the .bat file to finish?

If yes, a couple of links:

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

Here's a link to a nice ShellAndWait function that does that.
http://groups.google.com/groups?thre...%40tkmsftngp03

(I like to use the second one.)

====

I'm not sure why it kills the .bat file, though.

Robin Clay wrote:

Thank you for the suggestion - but acksherley....
VBA shells out to run a batch file
that takes several minutes to run.

Meanwhile, VBA continues,
and the next thing it does
is to kill the batch file -
but that is still running !

So I have inserted a MsgBox -
but if the user sees this,
she may be temopted to click OK...

So I wanted the DOS window to hide
the MsgBox until the batch file
has finished running.

Then the DOS window closes,
and the user may then click OK
to let VBA continue.

So I actually want the DOS window
to close on completion.

But what I was seeking
was a way to ensure
that the DOS window
covered the MsgBox.

Thanks again.

-----Original Message-----
I don't know a way of positioning the DOS window,
but you could stop it from closing:

Shell Environ("comspec") & _
" /k c:\runner.bat", vbNormalFocus

/c (instead of /k) will close the window

Robin Clay wrote:

Greetings !

I currently have this-
--------------------------------------------
Open "C:\Runner.bat" For Output As #1
Print #1, "@ECHO off"
Print #1, "Echo Please wait -"
Print #1, "Echo This may take some time ...."
Print #1, " [ other DOS commands ] ."
Close

Shell "C:\Runner.bat", vbNormalFocus

MsgBox "Please wait " & vbCrLf & _
"until the DOS window closes."

Kill "C:\Runner.bat"
----------------------------------------------

The reason for the MsgBox
is to prevent VBA from KILLing the batch file
until it has completed running.

I would like the DOS window to cover the MsgBox.

How can I specify whereabouts on the screen
the DOS window will appear?

RClay AT haswell DOT com


--

Dave Peterson

.


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to save a desired window size but hv window comeup fullsz by d smjm1982 Excel Discussion (Misc queries) 1 February 15th 08 11:10 AM
View cell contents as a pop-up window (similar to comments window) Oldersox Excel Worksheet Functions 1 February 6th 08 07:09 AM
Docking Project Explorer, Properties window and Code window in VBE jayray Setting up and Configuration of Excel 2 March 27th 07 04:42 PM
The window opens in a smaller window not full sized window. Rachael Excel Discussion (Misc queries) 0 November 7th 06 09:04 PM
How do I undo the Excel, Window Menu, New Window command OLDFANG Excel Discussion (Misc queries) 2 March 17th 06 05:31 PM


All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"