Table Property

Microsoft Office Visual Basic

expression.Table

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example sets the name of the table if the table name is currently blank.

Sub OfficeTest()

    Dim appOffice As OfficeDataSourceObject

    Set appOffice = Application.OfficeDataSourceObject
    appOffice.Open bstrConnect:="DRIVER=SQL Server;SERVER=ServerName;" & _
        "UID=user;PWD=;DATABASE=Northwind", bstrTable:="Employees"

    If appOffice.Table = "" Then
        appOffice.Table = "Employees"
    End If

End Sub