RobustConnect Property

Microsoft Excel Visual Basic

Show All

RobustConnect Property

       

Returns or sets how the PivotTable cache connects to its data source. Read/write XlRobustConnect.

XlRobustConnect can be one of these XlRobustConnect constants.
xlAlways  The cache always uses external source information (as defined by the SourceConnectionFile or SourceDataFile property) to reconnect.
xlAsRequired  The cache uses external source info to reconnect using the Connection property.
xlNever  The cache never uses source info to reconnect.

expression.RobustConnect

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

Example

The following example determines the setting for the cache connection and notifies the user. The example assumes a PivotTable exists on the active worksheet.


Sub CheckRobustConnect()

    Dim pvtCache As PivotCache

    Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)

    ' Determine the connection robustness and notify user.
    Select Case pvtCache.RobustConnect
        Case xlAlways
            MsgBox "The PivotTable cache is always connected to its source."
        Case xlAsRequired
            MsgBox "The PivotTable cache is connected to its source as required."
        Case xlNever
            MsgBox "The PivotTable cache is never connected to its source."
    End Select

End Sub