Skip to main content

DocumentProperty.LinkToContent property

Is True if the value of the custom document property is linked to the content of the container document. False if the value is static. Read/write.

Syntax

expression.LinkToContent(pfLinkRetVal)

expression A variable that represents a DocumentProperty object.

Parameters

Name Required/Optional Data type Description
pfLinkRetVal Required Boolean Indicates whether the document property is linked to the container document.

Remarks

This property applies only to custom document properties. For built-in document properties, the value of this property is False.

Use the LinkSource property to set the source for the specified linked property. Setting the LinkSource property sets the LinkToContent property to True.

For Excel, if LinkToContent is set to True, you must supply an address or range name for the LinkSource from the workbook. If the address or range name covers more than one cell, the custom document property takes the value from the top left cell of the range.

Example

This example displays the linked status of the custom document property. For the example to work, dp must be a valid DocumentProperty object.

Sub DisplayLinkStatus(dp As DocumentProperty)
    Dim stat As String, tf As String
    If dp.LinkToContent Then
        tf = ""
    Else
        tf = "not "
    End If
    stat = "This property is " & tf & "linked"
    If dp.LinkToContent Then
        stat = stat + Chr(13) & "The link source is " & dp.LinkSource
    End If
    MsgBox stat
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>