Hi James,
this code works for active model:
Option Explicit ' Application entry point Public Sub FindLevelsInReferences() MessageCenter.AddMessage "--- Levels in references ---", "", msdMessageCenterPriorityInfo, False IterateThrougAllReferences End Sub ' Iterate through all attachments Private Sub IterateThrougAllReferences() Dim att As attachment For Each att In ActiveModelReference.Attachments If (AttachmentCanBeProcessed(att)) Then PrintLevelsInAttachment att End If Next End Sub ' Do any testing if the attachment should be processed Private Function AttachmentCanBeProcessed(att As attachment) As Boolean If (att.AttachModelName = "Default") Then AttachmentCanBeProcessed = True Else AttachmentCanBeProcessed = False End If End Function ' Print information about attachment Private Sub PrintLevelsInAttachment(att As attachment) Dim lvl As Level For Each lvl In att.Levels MessageCenter.AddMessage att.AttachName & ": " & lvl.Name, "", msdMessageCenterPriorityInfo, False Next End Sub
You can use it to test it with your test dataset (files) and to adapt it to be called from your code.
With regards,
Jan