Microsoft KB Archive/178222

= How to launch Word from Internet Explorer =

Article ID: 178222

Article Last Modified on 3/27/2007

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 5.0
 * Microsoft Office 97 Developer Edition

-



This article was previously published under Q178222



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 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:  Launch Windows Explorer. If you are running Microsoft Windows NT 4.0, follow these steps:  On the View menu, click Options. If Internet Explorer 4.0 is installed, click Folder Options. In the Options dialog box, click the File Types tab. In Registered file types, click Microsoft Word Document, and then click Edit.

If you are running Microsoft Windows 2000 or a later version of Windows, follow these steps:  On the Tools menu, click Folder Options.</li> In the File Options dialog box, click the File Types tab.</li> In Registered file types, click Microsoft Word Document, and then click Advanced.</li></ol> </li> From the Edit File Type screen, click to clear the Browse in same window check box, which toggles whether a Word document is launched outside of Internet Explorer.</li> Click OK to close the dialog boxes.</li></ol>

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 Microsoft Word. Here are the basic steps:  Create a client-side function that instantiates Microsoft Word, and accepts the URL of the document as its argument.</li>  Create a button to call the function, passing the URL of the Word document.

Here's a sample client-side script using automation with Word 97 installed on the client computer: <HTML> <HEAD> <SCRIPT LANGUAGE=VBScript> Dim objWord Sub Btn1_onclick call OpenDoc("http://MyServer/MyTest.doc") End Sub

Sub OpenDoc(strLocation)

Set objWord = CreateObject("Word.Application") objWord.Visible = true objWord.Documents.Open strLocation End Sub

</SCRIPT> <TITLE>Launch Word</Title> </HEAD> <BODY> <INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc"> </BODY> </HTML> </li></ol>

NOTE For Word Automation to succeed, you must set your browser to Enable or to Prompt for Initialize and script ActiveX controls not marked as safe. If you set your browser to Disable, then the earlier sample code may produce a runtime error and may not work as expected.

<div class="references_section">