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

    Author
    Topic
    #365253

    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 smile

    Viewing 0 reply threads
    Author
    Replies
    • #563165

      Hi Cecilia,
      The code I use is:

      Sub RunWord()
         Shell "D:Program FilesMicrosoft OfficeOfficewinword.exe", vbMaximizedFocus
      End Sub
      

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

      • #563166

        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.)

        • #563168

          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)

          • #563170

            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 smile

    Viewing 0 reply threads
    Reply To: Shell path woes (Word 97, Win 95/98)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: