Share via


Workbooks.OpenDatabase Method

Returns a Workbook object representing a database.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function OpenDatabase ( _
    Filename As String, _
    CommandText As Object, _
    CommandType As Object, _
    BackgroundQuery As Object, _
    ImportDataAs As Object _
) As Workbook
'Usage
Dim instance As Workbooks
Dim Filename As String
Dim CommandText As Object
Dim CommandType As Object
Dim BackgroundQuery As Object
Dim ImportDataAs As Object
Dim returnValue As Workbook

returnValue = instance.OpenDatabase(Filename, _
    CommandText, CommandType, BackgroundQuery, _
    ImportDataAs)
Workbook OpenDatabase(
    string Filename,
    Object CommandText,
    Object CommandType,
    Object BackgroundQuery,
    Object ImportDataAs
)

Parameters

  • Filename
    Type: System.String

    Required String. The connection string.

  • CommandText
    Type: System.Object

    Optional Object. The command text of the query.

  • CommandType
    Type: System.Object

    Optional Object. The command type of the query. The following command types are available: Default, SQL, and Table.

  • BackgroundQuery
    Type: System.Object

    Optional Object. The background of the query.

  • ImportDataAs
    Type: System.Object

    Optional Object. Determines the format of the query.

Return Value

Type: Microsoft.Office.Interop.Excel.Workbook

See Also

Reference

Workbooks Interface

Workbooks Members

Microsoft.Office.Interop.Excel Namespace