Cannot access mdl.BusinessDataObjects.Count using a Macro

I've written a simple macro to tell me how many Business Data Objects there are in a Model, and it doesn't work. Whenever I try to access mdl.BusinessDataObjects.Count the response is (10510) Not an Object Reference.

I have a similar macro for list subtype clusters that works fine.

'#Language "WWB-COM"

Option Explicit

Sub Main
    Dim diag As Diagram
    Dim mdl As Model
    Dim submdl As SubModel
    Dim bdo As BusinessDataObject
    Dim msg As String
    Debug.Clear

    Set diag = DiagramManager.ActiveDiagram
    Set mdl = diag.ActiveModel
    Set submdl = mdl.ActiveSubModel
    Debug.Print "Working with " & diag.FileName
    Debug.Print " --- " & mdl.Name

    If mdl.BusinessDataObjects.Count > 0 Then
        Debug.Print "There are " & mdl.BusinessDataObjects.Count & " Business Data Objects"
        For Each bdo In mdl.BusinessDataObjects
            msg = "[" & bdo.LogicalName
            Debug.Print msg
        Next
    Else
        Debug.Print "The model does not have any Business Data Objects"
    End If
End Sub
Parents Reply Children
No Data