Shell

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

I am using the "Shell" comand from Excel to open different files. This works
fine until the path contains a space.

for instance, the following line

Shell "start " & pName & "\test.htm"

WORKS
when pName = "C:\Active\pictures\html\clifton"

FAILS
when pName = "C:\Active\pictures\html\alton on tees"


i.e. when the path contains a space an error is thrown!
Any Suggestions!
 
Hi Stuart,

If you surround the file and path name (but not the command) in double
quotes it should work whether or not there are embedded spaces, e.g.:

Shell "start """ & pName & "\test.htm"""

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
 

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

Back
Top