[program-l] Re: Odd Word Request

  • From: "George Bell" <george@xxxxxxxxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Fri, 21 May 2010 11:30:20 +0100

By heck, Pranav!  It even works!  Takes a heck of a while, but
obviously in my case has to look at around 80,000 characters.

And what's more, I actually managed to do it in that awful Word 2007!

Bless you, and may all your code compile flawlessly.

George.

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx
[mailto:program-l-bounce@xxxxxxxxxxxxx] On Behalf Of Pranav Lal
Sent: 21 May 2010 10:21
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: Odd Word Request

George,

A quick search on the words get list of fonts used in word document
leads me to the following macro from the link
http://word.tips.net/Pages/T001522_Creating_a_Document_Font_List.html.
Public Sub ListFontsInDoc()
    Dim FontList(199) As String
    Dim FontCount As Integer
    Dim FontName As String
    Dim J As Integer, K As Integer, L As Integer
    Dim X As Long, Y As Long
    Dim FoundFont As Boolean
    Dim rngChar As Range
    Dim strFontList As String

    FontCount = 0
    X = ActiveDocument.Characters.Count
    Y = 0
    ' For-Next loop through every character
    For Each rngChar In ActiveDocument.Characters
        Y = Y + 1
        FontName = rngChar.Font.Name
        StatusBar = Y & ":" & X
        ' check if font used for this char already in list
        FoundFont = False
        For J = 1 To FontCount
           If FontList(J) = FontName Then FoundFont = True
        Next J
        If Not FoundFont Then
            FontCount = FontCount + 1
            FontList(FontCount) = FontName
        End If
    Next rngChar

    ' sort the list
    StatusBar = "Sorting Font List"
    For J = 1 To FontCount - 1
        L = J
        For K = J + 1 To FontCount
            If FontList(L) > FontList(K) Then L = K
        Next K
        If J <> L Then
            FontName = FontList(J)
            FontList(J) = FontList(L)
            FontList(L) = FontName
        End If
    Next J

    StatusBar = ""
    ' put in new document
    Documents.Add
    Selection.TypeText Text:="There are " & _
      FontCount & " fonts used in the document, as follows:"
    Selection.TypeParagraph
    Selection.TypeParagraph
    For J = 1 To FontCount
        Selection.TypeText Text:=FontList(J)
        Selection.TypeParagraph
    Next J
End Sub

On 5/21/10, George Bell <george@xxxxxxxxxxxxxxxxxxx> wrote:
> Before I start a soul destroying Google search, does anyone know of
a
> quick and easy way to obtain a list of fonts used in a Word 2003
> Document?
>
>
>
> I have to produce a fairly complex braille mathematics notation
> document, and need to know of any non-standard system fonts used.
> (Aside from 9 specific ones which will be distributed with the
> document).
>
>
>
> This would not be a problem were it not for the fact that even
> embedding of fonts in Word is ignored by the mathematics software
> whose equations are also embedded in the document.
>
>
>
> George.
>
>
>
>
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: