HOWTO: Launch Word from Internet Explorer

Last reviewed: March 20, 1998
Article ID: Q178222
The information in this article applies to:
  • Microsoft Internet Explorer (Programming), versions 4.0, and 4.01
  • Microsoft Office 97 for Windows

SUMMARY

The purpose of this document is to explain how to control the client-side behavior when a hyper-text link to a Word document is selected. For example, clicking on a link to a Word document usually defaults to opening the document from within Internet Explorer. You can change this behavior so that the link opens the file in Word.

This article applies to both a desktop user of Internet Explorer, as well as a Web author, writing client-side script. Although this article is tailored to MS Word, the concepts apply to other Microsoft document applications (that is, Excel).

MORE INFORMATION

The following two basic approaches to controlling the behavior will be discussed:

  • As a user, you can set client options through Windows Explorer. The advantage of this approach is that the user retains control of the browser's behavior.
  • As a Web author, you can write client-side script. The advantage of this approach is that you can customize the client's behavior from a central location. However, there is a caveat: implementing this method requires a client-based installation of Office 97 and is inherently slow.

Use the following steps for the first approach--setting client options through Windows Explorer:

  1. Launch Windows Explorer.

  2. From the View menu, select Options("Folder Options" if Internet Explorer 4.0 is installed).

  3. From the Options dialog box, click the File Types tab.

  4. From the listing of "Registered File Types," select "Microsoft Word Document," and click Edit.

  5. From the Edit File Type screen, clear the "Browse in same window" check box, which toggles whether a Word document is launched outside of Internet Explorer.

  6. Click OK to close the dialog boxes.

Note that behind the scenes, simple Registry flags are being set, which means that someone with experience in creating .Reg files can automate this change.

For the second approach, as a Web author you can control the behavior of a Word document through OLE Automation, provided the client is running Word 97. Here are the basic steps:

  1. Create a client-side function that instantiates Microsoft Word, and accepts the URL of the document as its argument.

  2. Create either a button or an Anchor tag to call the function, passing the URL of the Word document.

    Here's a sample client-side script using OLE Automation with Word 97 installed on the client machine:

          <HTML>
          <HEAD>
          <SCRIPT LANGUAGE=VBScript>
          Function OpenDoc(strLocation)
          Dim objWord
    
             Set objWord = CreateObject("Word.Application")
             objWord.Visible = true
             objWord.Documents.Open strLocation
          End Function
          </SCRIPT>
          <TITLE>Launch Word</Title>
          </HEAD>
          <BODY>
          <A href="javascript:OpenDoc('http://MyServer/MyTest.doc')">my
             doc</a>
          </BODY>
          </HTML>
    
    

REFERENCES

For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/vinterdev/

Keywords          : VIScripting
Technology        : kbInetDev
Version           : WINDOWS:3.01,3.02,4.0,4.01,97
Platform          : WINDOWS
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 20, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.