Etudes for Microsoft Word Programmers. Appendix.


Information on this page is from Microsoft MSDN http://msdn.microsoft.com.

Hyperlinks (Word 2003)

 

"Insert/Edit Hyperlink" Dialog

Use the Insert Hyperlink dialog box to create a hyperlink in your Office file. A hyperlink is colored and underlined text or a graphic that you click to go to a file, a location in a file, a Web page on the World Wide Web, or a Web page on an intranet. Hyperlinks can also go to newsgroups and to Gopher, Telnet, and FTP sites.

You can create a hyperlink to a new file, to an existing file or Web page, to a specific location on a Web page, to a specific location in an Office file, create a hyperlink to an e-mail address. You can also assign a tip to be displayed when you rest the pointer on the hyperlink.

Insert Hyperlink dialog looks like these:

Hyperlink Object

Hyperlink Object Properties

Hyperlink object properties are described in the following table.

Property

Type

Description

Address

Read/write
String

Returns or sets the address (for example, a file name or URL) of the specified hyperlink.

EmailSubject

Read/write
String

Returns or sets the text string for the specified hyperlinks subject line. The subject line is appended to the hyperlinks Internet address, or URL.
Remarks
This property is commonly used with e-mail hyperlinks. The value of this property takes precedence over any e-mail subject specified in the Address property of the same Hyperlink object.

ExtraInfoRequired

Read-only
Boolean

True if extra information is required to resolve the specified hyperlink.
Note  You can specify extra information by using the ExtraInfo argument with the Follow or FollowHyperlink method. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name.

Name

Read-only

String

Returns or sets the name of the hyperlink.

Range

Range

Returns a Range object that represents the portion of a document that's contained in the specified object.

ScreenTip

Read/write
String

Returns or sets the text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink.

Shape

Shape

Returns a Shape object for the specified hyperlink or diagram node.
Remarks
If a hyperlink isn't represented by a shape, an error occurs.

SubAddress

Read/write String

Returns or sets a named location in the destination of the specified hyperlink.
Remarks
The named location can be a bookmark in a Microsoft Word document, a named cell or cell reference in a Microsoft Excel worksheet, a named object in a Microsoft Access database, or a slide number in a Microsoft PowerPoint presentation.

Target

Read/write String

Returns or sets the name of the frame or window in which to load the hyperlink.

TextToDisplay

Read/write String

Returns or sets the specified hyperlink's visible text in a document.

Type

Read-only MsoHyperlinkType

Returns the hyperlink type.

Enumeration MsoHyperlinkType

Enumeration msoHyperlinkType defines hyperlink type.

Constant

Value

msoHyperlinkInlineShape

2

msoHyperlinkRange

0

msoHyperlinkShape

1

Hyperlink Object Methods

Hyperlink object methods are described in the following table.

Method

Description

AddToFavorites

Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.

CreateNewDocument(
FileName,
EditNow,
Overwrite
)

Creates a new document linked to the specified hyperlink.

FileName   Required String. The file name of the specified document.

EditNow   Required Boolean. True to have the specified document open immediately in its associated editing environment. The default value is True.

Overwrite   Required Boolean. True to overwrite any existing file of the same name in the same folder. False if any existing file of the same name is preserved and the FileName argument specifies a new file name. The default value is False.

Delete

Deletes the specified object.

Follow(NewWindow, AddHistory,
ExtraInfo,
Method,
HeaderInfo
)

Displays a cached document associated with the specified Hyperlink object, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Note  If the hyperlink uses the file protocol, this method opens the document instead of downloading it.

NewWindow    Optional Variant. True to display the target document in a new window. The default value is False.

AddHistory    Optional Variant. This argument is reserved for future use.

ExtraInfo    Optional Variant. A string or byte array that specifies additional information for HTTP to use to resolve the hyperlink. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name. The string is either posted or appended, depending on the value of Method. Use the ExtraInfoRequired property to determine whether extra information is required.

Method    Optional Variant. Specifies the way additional information for HTTP is handled. Can be any MsoExtraInfoMethod constant.

HeaderInfo    Optional Variant. A string that specifies header information for the HTTP request. The default value is an empty string. You can combine several header lines into a single string by using the following syntax: "string1   " & vbCr & "string2   ". The specified string is automatically converted into ANSI characters. Note that the HeaderInfo argument may overwrite default HTTP header fields.

Enumeration MsoExtraInfoMethod

Constant

Value

msoMethodGet

ExtraInfo is a string that's appended to the address.

msoMethodPost

ExtraInfo is posted as a string or a byte array.

Hyperlinks Collection

Count property returns the number of items in the collection.

Hyperlinks Collection Methods

Hyperlinks collection methods are described in the following table.

Method

Description

Add(
Anchor,
Address,
SubAddress,
ScreenTip, TextToDisplay,
Target)

Anchor   Required Object. The text or graphic that you want turned into a hyperlink.

Address   Optional Variant. The address for the specified link. The address can be an e-mail address, an Internet address, or a file name. Note that Microsoft Word doesn't check the accuracy of the address.

SubAddress   Optional Variant. The name of a location within the destination file, such as a bookmark, named range, or slide number.

ScreenTip   Optional Variant. The text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink. The default value is Address.

TextToDisplay   Optional Variant. The display text of the specified hyperlink. The value of this argument replaces the text or graphic specified by Anchor.

Target   Optional Variant. The name of the frame or window in which you want to load the specified hyperlink.

Item(Index)

Returns a specified collection object.

 


Etudes for Microsoft Word Programmers. Appendix. Object Hyperlink.


Unless otherwise noted, all materials on this site are
2000-2009 Evgeny Akhundzhanov, All Rights Reserved Worldwide
Microsoft is in no way affiliated with, nor offers endorsement of, this site.
www.transcriber.ru | E-mail the Author