WorkbookConnection WorkbookConnection WorkbookConnection Interface

Definition

A connection is a set of information needed to obtain data from an external data source other than an 1st_Excel12 workbook.

public interface class WorkbookConnection
[System.Runtime.InteropServices.Guid("00024485-0000-0000-C000-000000000046")]
[System.Runtime.InteropServices.InterfaceType(2)]
public interface WorkbookConnection
Public Interface WorkbookConnection
Attributes

Remarks

Connections can be stored within an Excel workbook. When the workbook is opened, Excel creates an in-memory copy of the connection which is refered to as the connection object. A connection object contains information such as the name of the server and the name of the object to be opened on that server. Optionally, the connection object may also include authentication credentials and/or a command that is to be passed to the server and executed (example: a SELECT statement to be executed by SQL Server.)

Note: The exact form of the connection depends on the mechanism that is being used to retrieve data – ODBC connections, OLEDB connections, and Web Queries will contain different information.

A connection may also be stored in a separate connection file. Most connections in an Excel workbook include a pointer to an external connection file. Connection files have extensions that clearly label them as connection files (*.ODC, *.IQY, etc.) and may be located on the user's local machine or in other well known or trusted locations such as WSS (Data Connection Library), or other corporate servers. Connection files enable multiple users within the same organization to re-use connections. Network administrators are able to change the way the entire organization connects to a back-end data source by changing a single connection file. A connection file is not always required when connecting to an external data source.

Connection names are strings that uniquely identify connections within the workbook in which they are used. There are other properties of a connection that are not unique. Whenever a formula in Excel takes an argument that is a connection, it will be sufficient to refer to the name of that connection, either directly (as a string) or indirectly (by referring to a cell that contains the connection name as a string.)

Properties

_Default _Default _Default
Application Application Application

When used without an object qualifier, this property returns an _Application object that represents the Microsoft Office Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Creator Creator Creator

Returns a 32-bit integer that indicates the application in which this object was created. Read-only Integer.

DataFeedConnection DataFeedConnection DataFeedConnection

Returns a DataFeedConnection object that contains the data and functionality needed to connect to data feeds. Read-only

Description Description Description

Returns or sets a brief description for a WorkbookConnection object. Read/write String.

InModel InModel InModel

Specifies whether or not the WorkbookConnection object has been added to the model. Boolean (bool in C#) Read-only.

ModelConnection ModelConnection ModelConnection

Returns an object that contains information for the new Model Connection Type introduced in Excel 2013 to interact with the integrated Data Model. Read-only

ModelTables ModelTables ModelTables

Returns a ModelTables object associated with the particular connection. Read-only

Name Name Name

Returns or sets the name of the workbook connection object. Read/write String.

ODBCConnection ODBCConnection ODBCConnection

Retuns the ODBC Connection details for the specified WorkbookConnection object. Read-only ODBCConnection.

OLEDBConnection OLEDBConnection OLEDBConnection

Retuns the OLEDB Connection details for the specified WorkbookConnection object. Read-only OLEDBConnection.

Parent Parent Parent

Returns the parent object for the specified object. Read-only.

Ranges Ranges Ranges

Returns the range of object for the specified WorkbookConnection object. Read-only Ranges.

RefreshWithRefreshAll RefreshWithRefreshAll RefreshWithRefreshAll

Determines if the connection should be refreshed when refresh all is executed. Boolean (bool in C#). Read/Write.

TextConnection TextConnection TextConnection

Returns a TextConnection object that contains the information on a query to a text file. Read-only.

Type Type Type

Returns the workbook connection type. Read-only XlConnectionType.

WorksheetDataConnection WorksheetDataConnection WorksheetDataConnection

Returns an object that contains information for a connection from the PowerPivot Model to data within the workbook such as a range, named range, or table. Read-only.

Methods

Delete() Delete() Delete()

Deletes a workbook connection.

Refresh() Refresh() Refresh()

Refreshes a workbook connection.

Applies to