Share via


DocumentBase.DefaultTargetFrame Property

Gets or sets the browser frame in which to display a Web page reached through a hyperlink.

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 Property DefaultTargetFrame As String
public string DefaultTargetFrame { get; set; }

Property Value

Type: System.String
The browser frame in which to display a Web page reached through a hyperlink.

Remarks

The DefaultTargetFrame property has the following predefined strings: "_top", "_blank", "_parent", and "_self". It can also use any user-defined string.

Examples

The following code example sets Microsoft Office Word to open a new blank browser window when you click hyperlinks in the document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentDefaultTargetFrame()
        Me.DefaultTargetFrame = "_blank" 
        Dim address As Object = "https://www.msn.com/" 
        Me.Hyperlinks.Add(Me.Paragraphs(1).Range, address)
    End Sub
private void DocumentDefaultTargetFrame()
{
    this.DefaultTargetFrame = "_blank";
    object address = "https://www.msn.com/";
    this.Hyperlinks.Add(this.Paragraphs[1].Range, ref address, ref missing, 
        ref missing, ref missing,ref missing);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace