_QueryTable.MaintainConnection Property

True if the connection to the specified data source is maintained after the refresh and until the workbook is closed. The default value is True. Read/write Boolean.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Property MaintainConnection As Boolean
    Get
    Set
'Usage
Dim instance As _QueryTable
Dim value As Boolean

value = instance.MaintainConnection

instance.MaintainConnection = value
bool MaintainConnection { get; set; }

Property Value

Type: System.Boolean

Remarks

You can set the MaintainConnection property only if the QueryType property of the query table or PivotTable cache is set to xlOLEDBQuery.

If you anticipate frequent queries to a server, setting this property to True might improve performance by reducing reconnection time. Setting the property to False causes an open connection to be closed.

See Also

Reference

_QueryTable Interface

_QueryTable Members

Microsoft.Office.Interop.Excel Namespace