TableObject Object (Excel)

Represents a worksheet table built from data returned from a PowerPivot model.

Example

The following sample code creates a PowerPivot query table by connecting to a data source.

Sub CreateTable()
Dim objWBConnection As WorkbookConnection
Dim objWorksheet As Worksheet
Dim objTable As TableObject   'This is the new Table object

Set objWorksheet = ActiveWorkbook.Worksheets("Sheet1")

'Create a WorkbookConnection to the external data source first.
Set objWBConnection = ActiveWorkbook.Connections.Add2( _
        "Cubes3 AdventureWorksDW DimEmployee1", "", Array( _
        "OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=AdventureWorksDW;Data Source=MyServer;Use " _
        , _
        "Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MYWORKSTATION;Use Encryption for Data=False;Tag with co" _
        , "lumn collation when possible=False"), Array( _
        """AdventureWorksDW"".""dbo"".""DimEmployee"""), 3, True)

'Create a new table connected to the model.
Set objTable = objWorksheet.ListObjects.Add(SourceType:=xlSrcModel, Source:=objWBConnection, Destination:=Range("$A$1")).TableObject

objTable.Refresh

End Sub

Methods

Name
Delete
Refresh

Properties

Name
AdjustColumnWidth
Application
Creator
Destination
EnableEditing
EnableRefresh
FetchedRowOverflow
ListObject
Parent
PreserveColumnInfo
PreserveFormatting
RefreshStyle
ResultRange
RowNumbers
WorkbookConnection

See also

Excel Object Model Reference