how to find a font

how to find a subtitute font in a multiple page document. Exactly where is that font and on how many pages it has been used?

  • A 'substitute font' can be found only if you know its name. The term 'substitute font' does not have any signification for VBA.

    If you want to know in how many pages that specific font has been used it is not a big problem, but how would you like to express 'where is that font'? Using x,y coordinates? What do you have in mind when you ask about that?

    For instance, you can use the next piece of code to create a string containing the page name where the specific font is found as many times as it exists on that page. The code does not search in groups (it can be done to do also that if necessary but it is just an example). In order to play with it you should create a number of text boxes on each page you want, some of them to use the font 'Arimo'. It is easy to specify whatever font name you need:

    Dim CurSH As Shape, P As Page, strFont As String, strFontName As String
    strFontName = "Arimo"
    For Each P In ActiveDocument.Pages
        For Each CurSH In P.Shapes
            If CurSH.Type = cdrTextShape Then
                If CurSH.Text.Story.Font = strFontName Then strFont = strFont & P.Name & vbCrLf
            End If
    Debug.Print strFont

    The code can be adapted to return whatever you need. This is the basis I think in order to search a specific font in all pages...