Class Model (Excel VBA)

Thank you.

The main procedure of class Model is AddConnection


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

Dim mdl as Model
Set mdl = ActiveWorkbook.Model

Model class variables can be set using the Workbook.Model procedure.


The following procedures in this class have been grouped together and are described on a separate theme page

Model with its procedures DataModelConnection, ModelFormatBoolean, ModelFormatCurrency, ModelFormatDate, ModelFormatDecimalNumber, ModelFormatGeneral, ModelFormatPercentageNumber, ModelFormatScientificNumber, ModelFormatWholeNumber, ModelMeasures, ModelRelationships and ModelTables


This is the main method of the Model class

AddConnection - Adds a new WorkbookConnection to the model with the same properties as the one supplied as an argument.

Dim wbconAddConnection As WorkbookConnection
Set wbconAddConnection = ActiveWorkbook.Model.AddConnection(ConnectionToDataSource:=)

Other Methods

CreateModelWorkbookConnection - Returns a WorkbookConnection object of type ModelConnection.

Initialize - Initializes the Workbook's data model. This is called by default the first time the model is used.

Refresh - Refreshes all data sources associated with the model, fully reprocesses the model, and updates all Excel data features associated with the model.


Name returns a String value representing the name of the Model object.

Parent returns an object that represents the parent object of the specified object. Read-only.