WPS 加载项开发 > 表格 API 参考 > PivotCache > 属性 > PivotCache.RobustConnect 属性
返回或设置数据透视表缓存与其数据源连接的方式。XlRobustConnect 类型,可读写。

语法

表达式.RobustConnect

表达式   一个代表 PivotCache 对象的变量。

说明

XlRobustConnect 可为以下这些 XlRobustConnect 常量之一。
xlAlways 。缓存始终使用外部源信息(由 SourceConnectionFileSourceDataFile 属性定义)进行重新连接。
xlAsRequired 。缓存通过 Connection 属性使用外部源信息进行重新连接。
xlNever 。缓存从不使用源信息进行重新连接。

示例

下例确定缓存的连接设置,并通知用户。本示例假定数据透视表位于活动工作表上。

示例代码
function CheckRobustConnect() {

    let pvtCache = Application.ActiveWorkbook.PivotCaches().Item(1).RobustConnect
									
    // Determine the connection robustness and notify user.
    switch(pvtCache) {
        case 1:
            MsgBox("The PivotTable cache is always connected to its source.")
            break;
        case 0:
            MsgBox("The PivotTable cache is connected to its source as required.")
            break;
        case 2:
            MsgBox("The PivotTable cache is never connected to its source.")
            break;
    }
									
}


请参阅