View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Just Another Yahoo![_2_] Just Another Yahoo![_2_] is offline
external usenet poster
 
Posts: 10
Default How to run a shell command via VBA?

Use the SHELL command. In the VBE, type in the word SHELL, move the cursor
onto the word, then hit the F1 key to get the Help documentation for it.

For your situation (and a nod to Steve Yandl for the idea) I think this may
work:
....
Shell "CSCRIPT %windir%\system32\prnmngr.vbs -ac -p" & Chr(34) &
"\\rds1\Printer088" & Chr(34)
....
The Chr(34) is for placing the quotes around the printer location.
--
Toby Erkson
Excel 2003, WinXP

"Benjamin" wrote in message
...
I want to run shell commands via VBA?
particularly this one:

Which adds a printer default
CSCRIPT %windir%\system32\prnmngr.vbs -ac -p "\\rds1\Printer088"