Class ODBCConnection (Excel VBA)

The class ODBCConnection represents the ODBC connection.

Class WorkbookConnection gives access to class ODBCConnection.

Member in collection

Item

To use a ODBCConnection class variable it first needs to be instantiated, for example

Dim odb as ODBCConnection
Set odb = ActiveWorkbook.Connections(1).ODBCConnection

ODBCConnection class variables can be set using the WorkbookConnection.ODBCConnection procedure.

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

Refresh - Refreshes an ODBC connection.

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

Properties

AlwaysUseConnectionFile true if the connection file is always used to establish connection to the data source.

BackgroundQuery true if queries for the ODBC connection are performed asynchronously (in the background).

CommandText returns or sets the command string for the specified data source. Read/write Variant.

CommandType returns or sets one of the XlCmdType constants.

Connection returns or sets a string that contains ODBC settings that enable Microsoft Excel to connect to an ODBC data source.

EnableRefresh true if the connection can be refreshed by the user. The default value is True.

RefreshDate returns the date on which the ODBC connection was last refreshed.

Refreshing true if a background ODBC query is in progress for the specified ODBC connection.

RefreshOnFileOpen true if the connection is automatically updated each time the workbook is opened. The default value is False.

RefreshPeriod returns or sets the number of minutes between refreshes.

RobustConnect returns or sets how an ODBC connection connects to its data source.

SavePassword true if password information in an ODBC connection string is saved in the connection string. False if the password is removed.

ServerCredentialsMethod returns or sets the type of credentials that should be used for server authentication.

ServerSSOApplicationID returns or sets a single sign-on application (SSO) identifier that is used to do a lookup in the SSO database for credentials.

SourceConnectionFile returns or sets a String indicating the Microsoft Office Data Connection file or similar file that was used to create the connection.

SourceData returns the data source for the ODBC connection, as shown in the table.

SourceDataFile returns or sets a String indicating the source data file for an ODBC connection.