Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you both very much for your kind response to my plea
Put the DOS Dir command in a bat file and call that bat file from Shell. E.g, Shell "C:\Test.bat",1 Hmmm... I had thought of that, but thought there MUST be a better way ! Like this... Shell(Environ$("comspec") & " /c dir C:\ /S C:\DirList1.$$$",1) Spaces in the path or filename have to be wrapped in double quotes. Blimey, that's complicated ! I think I'll stick to Chip's method after all ! Thus :- Public Sub RunShell(myCommandLine, myWindowStyle) ' Write it to a batch file Open "C:\RunShell.bat" for Output as #1 Print #1, myCommandLine Close #1 ' Run the batch file Shell "C:\RunShell.bat", myWindowStyle ' Delete the batch file Kill "C:\RunShell.bat" End Sub So instead of Shell "dir C:\ /S C:\DirList1.$$$",1 I would use RunShell "dir C:\ /S C:\DirList1.$$$", WindowStyle Thanks again |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to use the "shell" command? | Excel Discussion (Misc queries) | |||
How can you wait for the SHELL command to terminate ? | Excel Programming | |||
Shell function II | Excel Programming | |||
Shell function | Excel Programming | |||
Copying a file with VBA (or with a SHELL command) | Excel Programming |