Shell Commands

W

Wayne

Hello,

I have a spreadsheet that uses the following to utalise
Windows Messaging Service:

Shell "Net send (pc name) (message)"

this loops several times to send multiple messages as I
can't greate a batch file due to system limitations. The
problem is this creates numerous cmd boxes on the task
bar, these do eventually disappear but it is fairly
untidy.
Is there any way I can stop the cmd boxes appearing
without using batch files?

Thanks
Wayne
 
J

jaf

Hi Wayne,
You just need to pipe the shell through the command processor. The /c kills
the cmd window when it's finished.

MyMessage = Shell(Environ$("comspec") & " /c Net send (pc name)
(message)",vbNormalFocus)

I'll assume pc name & message are variables so...(you'll need to loose that
space delimiter)

MyMessage = Shell(Environ$("comspec") & " /c Net send "& pcname & " " &
message,vbNormalFocus)

....should work for you. (watch the line wrap. Should be all one line)

--
John
johnf 202 at hotmail dot com


| Hello,
|
| I have a spreadsheet that uses the following to utalise
| Windows Messaging Service:
|
| Shell "Net send (pc name) (message)"
|
| this loops several times to send multiple messages as I
| can't greate a batch file due to system limitations. The
| problem is this creates numerous cmd boxes on the task
| bar, these do eventually disappear but it is fairly
| untidy.
| Is there any way I can stop the cmd boxes appearing
| without using batch files?
|
| Thanks
| Wayne
 
Top