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

S

Simon Lloyd

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
 
A

Auric__

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"
 
S

Simon Lloyd

I tried removing the K/ switch the cmd program launched but did nothin
else....just hung there......is there another solution?

Simo
 
T

Tom Ogilvy

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
 
A

Auric__

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top