+ Reply to Thread
Results 1 to 2 of 2

Shell

  1. #1
    Stuart
    Guest

    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!



  2. #2
    Rob Bovey
    Guest

    Re: 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" <hssdn@jjse.dft> wrote in message
    news:cv0q3h$jmg$1@newsg4.svr.pol.co.uk...
    >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!
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1