View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
PapaDos PapaDos is offline
external usenet poster
 
Posts: 208
Default Problem with Shell command

For names with spaces, the start command is a bit tricky, it interprets the
first string within quotes as the new window title !
We need to give it a dummy a (it could be empty) string before the command
we need to execute.

Then we need to put target in quotes, either at the definition:

target = """C:/vba/copy7.htm"""
Shell "cmd /cStart """" " & target

or at the shell call:

Shell "cmd /cStart """" """ & target & """"




Alternatively, on most Windows XP setups, the call command is not necessary
at all:

target = """C:/vba/copy7.htm"""
Shell "cmd /c" & target

or

target = "C:/vba/copy7.htm"
Shell "cmd /c""" & target & """"

--
Regards,
Luc.

"Festina Lente"


"Andrew Hall NZ" wrote:

That's very neat PapaDos but how do I deal with a situation where the file
name (or parent folder name) contains spaces eg:

VB & VBA in a Nutshell (VB6).1998.OReilly.pdf