ODBCConnection ODBCConnection ODBCConnection Interface


Represents the ODBC connection.

public interface class ODBCConnection
public interface ODBCConnection
Public Interface ODBCConnection


An ODBC connection can be stored in an Excel workbook. When Micrososft Excel opens the workbook, Excel creates an in-memory copy of the ODBC connection known as the ODBCConnection object.

An ODBCConnection object contains information related to the connection, such as the name of the server to connect to and the name of the objects to be opened on that server. Optionally, the ODBCConnection object may also include authentication credential information, or a command that is to be passed to the server and executed (for example, a SELECT statement to be executed by SQL Server).


AlwaysUseConnectionFile AlwaysUseConnectionFile AlwaysUseConnectionFile

True if the connection file is always used to establish connection to the data source. Read/write Boolean.

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.

BackgroundQuery BackgroundQuery BackgroundQuery

True if queries for the ODBC connection are performed asynchronously (in the background). Read/write Boolean.

CommandText CommandText CommandText

Returns or sets the command string for the specified data source. Read/write Object.

CommandType CommandType CommandType

Returns or sets one of the XlCmdType constants. Read/write XlCmdType.

Connection Connection Connection

Returns or sets a string that contains ODBC settings that enable Microsoft Excel to connect to an ODBC data source. Read/write Object.

Creator Creator Creator

Returns a constant in the XlCreator enumeration that indicates the application in which this object was created. Read-only.

EnableRefresh EnableRefresh EnableRefresh

True if the connection can be refreshed by the user. The default value is True. Read/write Boolean.

Parent Parent Parent

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

RefreshDate RefreshDate RefreshDate

Returns the date on which the ODBC connection was last refreshed. Read-only DateTime.

Refreshing Refreshing Refreshing

True if a background ODBC query is in progress for the specified ODBC connection. Read/write Boolean.

RefreshOnFileOpen RefreshOnFileOpen RefreshOnFileOpen

True if the connection is automatically updated each time the workbook is opened. The default value is False. Read/write Boolean.

RefreshPeriod RefreshPeriod RefreshPeriod

Returns or sets the number of minutes between refreshes. Read/write Integer.

RobustConnect RobustConnect RobustConnect

Returns or sets how ODBC connection connects to its data source. Read/write XlRobustConnect.

SavePassword SavePassword SavePassword

True if password information in an ODBC connection string is saved in the connection string. False if the password is removed. Read/write Boolean.

ServerCredentialsMethod ServerCredentialsMethod ServerCredentialsMethod

Returns or sets the type of credentials that should be used for server authentication. Read/write XlCredentialsMethod.

ServerSSOApplicationID ServerSSOApplicationID ServerSSOApplicationID

Returns or sets a single sign-on application (SSO) identifier that is used to do a lookup in the SSO database for credentials. Read/write String.

SourceConnectionFile SourceConnectionFile SourceConnectionFile

Returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection. Read/write.

SourceData SourceData SourceData

Returns the data source for the ODBC connection, as shown in the table. Read/write Object.

SourceDataFile SourceDataFile SourceDataFile

Returns or sets a String indicating the source data file for an ODBC connection. Read/write.


CancelRefresh() CancelRefresh() CancelRefresh()

Cancels all refresh operations in progress for the specified ODBC connection.

Refresh() Refresh() Refresh()

Refreshes an ODBC connection.

SaveAsODC(String, Object, Object) SaveAsODC(String, Object, Object) SaveAsODC(String, Object, Object)

Saves the ODBC connection as a Microsoft Office Data Connection file.

Applies to