Class ModelTables (Excel VBA)

A collection of model tables inside the data model. To use a ModelTables class variable it first needs to be instantiated, for example


Dim mts as ModelTables
Set mts = ActiveWorkbook.Model.ModelTables

For Each

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


Dim mdlt As ModelTable
For Each mdlt In ActiveWorkbook.Model.ModelTables
	
Next mdlt

Count

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


Dim lngCount As Long
lngCount = ActiveWorkbook.Model.ModelTables.Count

Item

Returns a single object from the ModelTables collection.

Item (Index)

Index: The index number or name of the object.


Dim mdlt As ModelTable
Set mdlt = ActiveWorkbook.Model.ModelTables(Index:=1)