Word.Tips.Net WordTips (Menu Interface)

Keeping a Document Open After Hyperlinking

If you use Word 97 or Word 2000, you can create hyperlinks in your documents. These links can be to either Internet resources or to other documents to which you have access. As documented in other WordTips issues, you create hyperlinks by using the Insert Hyperlink tool on the toolbar.

There can be a problem with hyperlinks, however. Subscriber Robin McLeod wrote to describe a problem that popped up with hyperlinks. If the hyperlink was to an Excel workbook, the workbook would open and then the Word document that contained the hyperlink would close. (Word would remain open, but the document itself would close.) Other subscribers wrote to say that they had observed the same behavior on their systems. It seems that this behavior is only present in Word 97, and not in Word 2000.

Actually, the behavior is a little more odd than what is described here. In reality, Word 97 closes the document if its "dirty" flag is not set. In other words, if there are no unsaved changes in the document, then it closes. If the document has been changed and not saved, then the document remains open after clicking on the hyperlink.

The solution to this problem is in the way in which the hyperlink itself is put together. Let's say you were linking to an Excel workbook called MyWorkbook. If you took a look at the field that created the hyperlink, it would look like the following. (You can look at the field code by positioning the insertion point just to the left of the hyperlink and then pressing Shift+F9.)

{ HYPERLINK "MyWorkbook.xls" }

When you click on this link, Word tries to load the target of the link into the current document window. In order to do that, it closes the current document. When it figures out that the target is an Excel workbook, it opens Excel, but the original Word document is still closed. (This behavior is sort of like moving from one Web page to another. When you click on a hyperlink, the old Web page is discarded and the new one is loaded.)

What you need to do is modify the hyperlink field so it looks like this:

{ HYPERLINK "MyWorkbook.xls" \n }

The \n switch causes Word to open the hyperlink target in a new window. Again, this is sort of like the "Open in New Window" command open on several different Web browsers. Word dutifully leaves the original document open (whether it has been saved or not) and opens the target in its own window.

Again, this "fix" is only necessary in Word 97. In Word 2000 the target of the hyperlink is always opened in a new window, and the original document remains open. Thus, it would appear that there is no real need for the \n switch for the hyperlink field in Word 2000.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1421) applies to Microsoft Word 97 and 2000.

Related Tips:

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2017 Sharon Parq Associates, Inc.