TargetBrowser Property

Microsoft Word Visual Basic

Show All

TargetBrowser Property

       

Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.

MsoTargetBrowser can be one of these MsoTargetBrowser constants.
msoTargetBrowserIE4  Microsoft Internet Explorer 4.0.
msoTargetBrowserIE5  Internet Explorer 5.
msoTargetBrowserIE6  Internet Explorer 6.
msoTargetBrowserV3  Netscape Navigator 3.
msoTargetBrowserV4  Netscape Navigator 4.

expression.TargetBrowser

expression   Required. An expression that returns one of the objects in the Applies To list.

Remark

The TargetBrowser property sets the BrowserLevel property, but BrowserLevel is only important if the DisableFeatures property is set to True. Otherwise, it is ignored. The TargetBrowser property, however, is not ignored and sets the browser level for all Web documents or for a single Web document.

Example

This example sets the target browser for the active document to Microsoft Internet Explorer 6 if the current target browser is an earlier version.

Sub SetWebBrowser()
    With ActiveDocument.WebOptions
        If .TargetBrowser < msoTargetBrowserIE6 Then
            .TargetBrowser = msoTargetBrowserIE6
        End If
    End With
End Sub

This example sets the target browser for all documents to Internet Explorer 6.

Sub GlobalTargetBrowser()
    Application.DefaultWebOptions _
        .TargetBrowser = msoTargetBrowserIE6
End Sub