Share via


WorkbookConnection Interface

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

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

Syntax

'Declaration
<InterfaceTypeAttribute()> _
<GuidAttribute("00024485-0000-0000-C000-000000000046")> _
Public Interface WorkbookConnection
'Usage
Dim instance As WorkbookConnection
[InterfaceTypeAttribute()]
[GuidAttribute("00024485-0000-0000-C000-000000000046")]
public interface WorkbookConnection

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.)

See Also

Reference

WorkbookConnection Members

Microsoft.Office.Interop.Excel Namespace