OLEDBConnection.MakeConnection method (Excel)

Establishes a connection for the specified OLE DB connection.

Syntax

expression.MakeConnection

expression A variable that represents an OLEDBConnection object.

Return value

Nothing

Remarks

The MakeConnection method can be used when a connection drops and the user wants to reestablish the connection.

Various objects and methods might return a run-time error if the connection is dropped. Use of this method assures a connection before executing other objects or methods.

Note

Microsoft Excel might drop a connection temporarily in the course of a session (unknown to the VBA programmer), so this method proves useful.

This method will result in a run-time error if the MaintainConnection property of the specified OLE DB connection has been set to False.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.