HOWTO: Launch Word from Internet Explorer
ID: Q178222
|
The information in this article applies to:
-
Microsoft Internet Explorer (Programming) versions 5.0, 4.0, 4.01
-
Microsoft Office Developer Edition 97
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:
- Launch Windows Explorer.
- From the View menu, select Options("Folder Options" if Internet
Explorer 4.0 is installed).
- From the Options dialog box, click the File Types tab.
- From the listing of "Registered File Types," select "Microsoft Word
Document," and click Edit.
- 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.
- 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 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.
- 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>
REFERENCESFor more information, please see the MSDN Web Workshop:
http://msdn.microsoft.com/workshop/default.asp
Additional query words:
hyperlink
Keywords : kbIE400 kbIE401 kbIE500 kbDSupport VIScripting
Version : WINDOWS:4.0,4.01,5.0,97
Platform : WINDOWS
Issue type : kbhowto
|