Opening the Connection

With the connection declared, you can open it wherever it makes sense to do so in your VBA code. After it's open, you can begin to move data back and forth across the connection.

This is another area that highlights the flexibility in ADO: As you'll see, it's even possible to establish the connection and open it simultaneously. Depending on your preferences, you can provide the connection string to the Connection object directly, as shown in the prior section. Or you can provide it as an argument to the Connection object's Open method, as shown in the following sections.

Using the Open Method with No Arguments

If you've already supplied the necessary connection information to the Connection object, you can simply invoke ...

Get Managing Data with Microsoft® Excel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.