Тема: поиск текста на layout

Ищу текст на всех лэйаутах, как определить что на лэйауте у блока тип- acadmtext или acadtext?

Public Sub find_substr()
Dim spaceBlk As AcadBlock
For i = 1 To ThisDrawing.Blocks.Count - 1
    If ThisDrawing.Blocks(i).IsLayout = True Then
        msg = MsgBox(ThisDrawing.Blocks(i).Layout.Name)
        msg = MsgBox(ThisDrawing.Blocks(i).Layout.Block.Count)
        Set spaceBlk = ThisDrawing.Blocks(i).Layout.Block
        For j = 0 To spaceBlk.Count - 1
            ???????
        Next j
    End If
Next i
End Sub

Re: поиск текста на layout

Разобрался, может кому пригодится, можно использовать как рыбу для поиска разных обьектов...

Private Sub CommandButton1_Click()
Dim spaceBlk As AcadBlock
Dim my_mtxt As AcadMText
Dim my_txt As AcadText
If TextBox1.Text = "" Then Exit Sub
ListView1.ListItems.Clear
find_str = LCase(TextBox1.Text)
For i = 1 To ThisDrawing.Blocks.Count - 1
    If ThisDrawing.Blocks(i).IsLayout = True Then
        my_space = ThisDrawing.Blocks(i).Layout.Name
        Set spaceBlk = ThisDrawing.Blocks(i).Layout.Block
        For j = 0 To spaceBlk.Count - 1
            If TypeOf spaceBlk.Item(j) Is AcadMText Then
                    Set my_mtxt = spaceBlk.Item(j)
                    my_str = LCase(my_mtxt.TextString)
                    If InStr(1, my_str, find_str) > 0 Then
                        Set my_lst = ListView1.ListItems.Add(, , my_space)
                        my_lst.SubItems(1) = my_str
                    End If
            End If
            If TypeOf spaceBlk.Item(j) Is AcadText Then
                    Set my_txt = spaceBlk.Item(j)
                    my_str = LCase(my_txt.TextString)
                    If InStr(1, my_str, find_str) > 0 Then
                        Set my_lst = ListView1.ListItems.Add(, , my_space)
                        my_lst.SubItems(1) = my_str
                    End If
            End If
        Next j
    End If
Next i
End Sub

==========================================

Private Sub UserForm_Activate()
ListView1.View = lvwReport
ListView1.GridLines = True
ListView1.ColumnHeaders.Add Text:="Лист"
ListView1.ColumnHeaders.Add Text:="Текст", Width:=600
End Sub

Re: поиск текста на layout

[rus] A mozhno tak:
[/rus]

Dim Layouts As AcadLayouts, Layout As ACADLayout, LayArea As AcadBlock
Dim AnyObj As AcadEntity, AnyString As String
   Set Layouts = ThisDrawing.Layouts
   For Each Layout In Layouts
        If Not Layout.Name = "Model" Then
            Set LayArea = Layout.Block
            For n = 0 To LayArea.Count - 1
                Set AnyObj = LayArea.Item(n)
                If TypeName(AnyObj) Like "*IAcad*Text*" Then
                    AnyString = AnyObj.TextString
                  .....
                  .....
                  .....
                  .....
                End If
             Next
        End If
   Next