ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shell (https://www.excelbanter.com/excel-programming/323394-shell.html)

Stuart[_20_]

Shell
 
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!



Rob Bovey

Shell
 
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

"Stuart" wrote in message
...
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!






All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com