OpenDatabase Method
Returns a Workbook object representing a database.
expression.OpenDatabase(FileName, CommandText, CommandType, BackgroundQuery, ImportDataAs)
expression Required. An expression that returns one of the objects in the Applies To list.
FileName Required String. The connection string.
CommandText Optional Variant. The command text of the query.
CommandType Optional Variant. The command type of the query. The following command types are available: Default, SQL, and Table.
BackgroundQuery Optional Variant. The background of the query.
ImportDataAs Optional Variant. Determines the format of the query.
Example
In this example, Microsoft Excel opens the "northwind.mdb" file. This example assumes a file called "northwind.mdb file" exists on the C:\ drive.
Sub UseOpenDatabase()
' Open the Northwind database.
Workbooks.OpenDatabase _
FileName:="C:\northwind.mdb"
End Sub