Help to find a font

Hi i am looking for a macro that can find a specific font being used on which page of my document. Please help

Parents
  • Chris, 

    I knew I had written something like this in the past, just needed to find it. This is better as it does what you ask. Select a line of artistic text and it will draw a yellow rectangle around other text that uses that font. 

    This is a basic version, It doesn't find Text in Powerclips or if multiple fonts are used in the same line of Artistic Text it would find it. But again, it give you something to build off.

    Sub HiliteFont()
        Dim p As Page, s As Shape, sRect As Shape
        Dim sr As ShapeRange
        Dim strFontName As String
        Dim x As Double, y As Double, w As Double, h As Double
        
        If ActiveShape Is Nothing Then MsgBox "Please select a text shape that has the font you are looking for. Exiting...", vbCritical, "HiliteFont": Exit Sub
        If ActiveShape.Type <> cdrTextShape Then MsgBox "Please select a text shape that has the font you are looking for. Exiting...", vbCritical, "HiliteFont": Exit Sub
        
        strFontName = ActiveShape.Text.Story.Font
        
        For Each p In ActiveDocument.Pages
            Set sr = p.Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph' and @com.text.story.Font ='" & strFontName & "'")
            
            For Each s In sr.Shapes
                s.GetBoundingBox x, y, w, h
                Set sRect = ActiveVirtualLayer.CreateRectangle2(x - 0.1, y - 0.1, w + 0.2, h + 0.2)
                sRect.Outline.SetNoOutline
                sRect.Fill.ApplyUniformFill CreateCMYKColor(0, 0, 100, 0)
                Set sRect = ActiveDocument.LogCreateShape(sRect)
                sRect.OrderBackOf s
            Next s
        Next p
    End Sub
    

    Happy Coding, 

    -Shelby

Reply Children
No Data