Find text on Layer 1

Using the code below, what would I need to add/remove to allow selection of textfont on the Layer 1?

 

        Set sr = ActivePage.Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph'")
        For Each s In sr
            If s.Text.Story.Font = strFont Then
                If ar1(0) = "" Then
                    ar1(0) = " " & s.StaticID
                Else
                    ReDim Preserve ar1$(UBound(ar1) + 1)
                    ar1(UBound(ar1)) = " " & s.StaticID
                End If
            End If
        Next s

Parents
  • If you only want to find text on Layer 1 search only it instead of the entire page. You can also use CQL to for the font, so you could do this:

        Dim sr As ShapeRange
        Dim strFontName As String
        
        strFontName = "Arial"
        
        Set sr = ActivePage.Layers("Layer 1").Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph' and @com.text.story.font = '" & strFontName & "'")
    

    That should select only the text on Layer 1 with the Arial Font. Hope that helps,

    -Shelby

Reply Children
No Data