TableObject 对象 (Excel)
表示从 PowerPivot 模型返回的数据生成的工作表表。
示例
以下示例代码通过连接到数据源来创建 PowerPivot 查询表。
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
方法
属性
- AdjustColumnWidth
- 应用程序
- Creator
- 目标
- EnableEditing
- EnableRefresh
- FetchedRowOverflow
- ListObject
- Parent
- PreserveColumnInfo
- PreserveFormatting
- RefreshStyle
- ResultRange
- RowNumbers
- WorkbookConnection
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。