Class ModelTableColumns (Excel VBA)

The class ModelTableColumns represents a ModelTableColumn collection of single columns inside a ModelTable object. To use a ModelTableColumns class variable it first needs to be instantiated, for example


Dim mtcs as ModelTableColumns
Set mtcs = ActiveWorkbook.Model.ModelTables(1).ModelTableColumns

For Each

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


Dim mtc As ModelTableColumn
For Each mtc In ActiveWorkbook.Model.ModelRelationships.ModelTableColumns
	
Next mtc

Count

Returns a Long value that represents the number of ModelTableColumn objects in a ModelTableColumns object.


Dim lngCount As Long
lngCount = ActiveWorkbook.Model.ModelTables(1).ModelTableColumns.Count

Item

Returns a ModelTableColumn object from the ModelTableColumns collection.

Item (Index)

Index: The index number for the object.


Dim mtc As ModelTableColumn
Set mtc = ActiveWorkbook.Model.ModelTables(1).ModelTableColumns(Index:=1)