Udostępnij za pośrednictwem


DocumentBase.FollowHyperlink Method

Resolves a hyperlink, or displays a cached document if the document has already been downloaded.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub FollowHyperlink ( _
    ByRef address As Object, _
    ByRef subAddress As Object, _
    ByRef newWindow As Object, _
    ByRef addHistory As Object, _
    ByRef extraInfo As Object, _
    ByRef method As Object, _
    ByRef headerInfo As Object _
)
public void FollowHyperlink(
    ref Object address,
    ref Object subAddress,
    ref Object newWindow,
    ref Object addHistory,
    ref Object extraInfo,
    ref Object method,
    ref Object headerInfo
)

Parameters

  • address
    Type: System.Object%
    The address of the target document.
  • subAddress
    Type: System.Object%
    The location within the target document. The default value is an empty string.
  • newWindow
    Type: System.Object%
    true to display the target location in a new window. The default value is false.
  • addHistory
    Type: System.Object%
    true to add the link to the current day's history folder.
  • extraInfo
    Type: System.Object%
    A string or a 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.
  • headerInfo
    Type: System.Object%
    A string that specifies header information for the HTTP request. The default value is an empty string. In Visual Basic, 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 might overwrite default HTTP header fields.

Remarks

This method displays the cached document located at the Address parameter, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application. If the hyperlink uses the file protocol, this method opens the document instead of downloading it.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the FollowHyperlink method to display a Web page in a new window. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentFollowHyperlink()
    Me.FollowHyperlink(Address:="http://www.adatum.com", _
        NewWindow:=True, AddHistory:=False)
End Sub
private void DocumentFollowHyperlink()
{
    object address = "http://www.adatum.com/";
    object newWindow = true;
    object addHistory = false;

    this.FollowHyperlink(ref address, ref missing, ref newWindow,
        ref addHistory, ref missing, ref missing, ref missing);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace