ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to get the cmd window to close in VBA?? (https://www.excelbanter.com/excel-programming/301700-how-get-cmd-window-close-vba.html)

Simon Lloyd[_489_]

how to get the cmd window to close in VBA??
 
I have written some code to open a program on a PC when a certai
condition exists, this works fine and does the job, however the cm
window is still left open after this operation anyone know how to clos
it in VBA???

Here's the code i use.....

shell("cmd /k C:\notes\notes.exe")

where notes is the program to open.


Simo

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


Auric__

how to get the cmd window to close in VBA??
 
On Thu, 17 Jun 2004 03:50:41 -0500, Simon Lloyd
wrote:

I have written some code to open a program on a PC when a certain
condition exists, this works fine and does the job, however the cmd
window is still left open after this operation anyone know how to close
it in VBA???

Here's the code i use.....

shell("cmd /k C:\notes\notes.exe")

where notes is the program to open.


Simon


Remove the "/k" - that specifically tells cmd.exe to run the program you
specify and then remain open. In fact, you should really remove "cmd"
entirely and just do
shell "c:\notes\notes.exe"

--
auric underscore underscore at hotmail dot com
*****
If you only face forward, there is something you will miss seeing.
-- Vash the Stampede (Trigun)

Simon Lloyd[_490_]

how to get the cmd window to close in VBA??
 
Auric,

Thanks will try that......this VB/VBA stuff is all very new to me.

Simo

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


Simon Lloyd[_491_]

how to get the cmd window to close in VBA??
 
I tried removing the K/ switch the cmd program launched but did nothin
else....just hung there......is there another solution?

Simo

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


Tom Ogilvy

how to get the cmd window to close in VBA??
 
shell("cmd /C C:\notes\notes.exe")

/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains

--
Regards,
Tom Ogilvy


"Simon Lloyd " wrote in message
...
I tried removing the K/ switch the cmd program launched but did nothing
else....just hung there......is there another solution?

Simon


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




Auric__

how to get the cmd window to close in VBA??
 
On Thu, 17 Jun 2004 09:22:31 -0400, Tom Ogilvy wrote:

shell("cmd /C C:\notes\notes.exe")

/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains


....or do as I said: remove "cmd" entirely and just shell straight to
Notes.
--
auric underscore underscore at hotmail dot com
*****
My bleeding eardrums and I take it that was a yes?


All times are GMT +1. The time now is 02:35 PM.

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