Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Shell path woes (Word 97, Win 95/98)

    Hi--

    I have a toolbar in Word that opens a variety of other applications, such as Access, Excel, IE, etc. I've been using shell to open the applications, which is fine in a perfect world, because you need to use the DOS path (for example, c:Progra~1Micros~1TemplatesfoUBPRTemp.xls). The problem with this is what if Microsoft Office is not Micros~1 in DOS? If the user has other Microsoft products installed, it can't find the file. I've tried using the full path, with no success: Shell doesn't like the spaces, and I've seen the suggestion to use the single quotes, but then it tells me that it can't find the file.

    Has anyone else had this problem? Has anyone found a solution?

    Thanks!

    Cecilia <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Shell path woes (Word 97, Win 95/98)

    Hi Cecilia,
    The code I use is:
    <pre>Sub RunWord()
    Shell "D:Program FilesMicrosoft OfficeOfficewinword.exe", vbMaximizedFocus
    End Sub
    </pre>

    Hope that helps but I'm running Win2k so can't guarantee it will work the same under Win95/98.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Shell path woes (Word 97, Win 95/98)

    I'm guessing that it's Win 95/98 that's the problem, then.

    Here's what I'm using now:
    Call Shell("Excel.exe c:Progra~1Micros~1TemplatesfoUBPRTemp.xls", 1)

    This doesn't work because of the spaces:
    Call Shell("Excel.exe c:Program FilesMicrosoft OfficeTemplatesfoUBPRTemp.xls", 1)

    And neither does:
    Call Shell("'Excel.exe' 'c:Program FilesMicrosoft OfficeTemplatesfoUBPRTemp.xls'", 1)
    (with or without full path to Excel, it can't seem to find excel with the extra quote around it.)

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Shell path woes (Word 97, Win 95/98)

    Oh sorry, I hadn't realised you were opening a file as well. Have you tried:
    call shell ("excel.exe ""c:Program FilesMicrosoft OfficeTemplatesfoUBPRTemp.xls""", 1)
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Shell path woes (Word 97, Win 95/98)

    Bingo!!!! Muchas gracias! Had my quotes all wrong.

    One double quote to start, then surround the file path with two double quotes, end with the one double quote. Guess I couldn't see all that on the screen. Works like a charm <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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