Public Function block_count() As Integer Dim BlockObj As AcadBlock Dim n As Integer For Each BlockObj In acadDoc.Application.ActiveDocument.Blocks If Trim(Mid(BlockObj.Name, 1, 3)) = "mxb " Then n = n + 1
End If Next block_count = n Set BlockObj = Nothing
End Function
"""'"""""" = "mxb" & Trim(Str(block_count()))