In my workbook, I'm attempting to display the names of my DataModels. I defined model as an object in the next line of code.
For Each model In ThisWorkbook.model.WorkbookDataModels
The message "Object doesn't support this property or function" appears to me.
I've confirmed that the references section has the Microsoft Excel 16.0 Object Library checked. I work using Excel 365. Why am I mishandling this? I appreciate any help you can give.
Here is the code:
Sub ShowDataModels()
    Dim model As Object
    Dim tbl As Object
    Dim rel As Object
    
    For Each model In ThisWorkbook.model.WorkbookDataModels
        Debug.Print "Data Model Name: " & model.ModelName
        Debug.Print "  Tables:"
        
        For Each tbl In model.ModelTables
            Debug.Print "    " & tbl.Name
        Next tbl
        
        Debug.Print "  Relationships:"
        
        For Each rel In model.ModelRelationships
            Debug.Print "    " & rel.FromTable.Name & " -> " & rel.ToTable.Name
        Next rel
    Next model
End Sub