Class ModelTable (Excel VBA)

The class ModelTable represents a table in the data model.

Set

To use a ModelTable class variable it first needs to be instantiated, for example

Dim strIndex As String: strIndex = 
Dim mdl As Model: Set mdl = 
Dim mdltModelTable As ModelTable
Set mdltModelTable = mdl.ModelTables(Index:=strIndex)

The following procedures can be used to set variables of type ModelTable: ModelRelationship.ForeignKeyTable, ModelRelationship.PrimaryKeyTable, ModelTables.Item, Model.ModelTables and WorkbookConnection.ModelTables

For Each

Here is an example of processing the ModelTable items in a collection.

Dim mdl As Model: Set mdl = 
Dim mdltModelTable As ModelTable
For Each mdltModelTable In mdl.ModelTables
	
Next mdltModelTable

ModelTableColumns

Collection of ModelTableColumns objects that make up the ModelTable.

Name

Returns a String value that represents the name of the object.

Parent

Returns an object that represents the parent object of the specified ModelTable object. Read-only.

RecordCount

Returns the total row count for the model table.

Refresh

Refreshes the model table source connections.

SourceName

Name of the data source for the table. If the table has no data source, the call will generate a run-time error.

SourceWorkbookConnection

Returns the Workbook Connection from which the model table originated.

ModelTables.Count

Returns a Long value that represents the number of ModelTable objects in a ModelTables collection.

ModelTables.Item

Returns a single object from the ModelTables collection.

Syntax : expression.Item (Index)

Index: The index number or name of the object.

ModelTables.Parent

Returns an object that represents the parent object of the specified ModelTables object. Read-only.