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:
- 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 Word
97. 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 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