Discussion:
Which fonts are called for?
(too old to reply)
asur
2006-11-18 19:57:02 UTC
Permalink
Is there any way of finding out which fonts are called for in a Word 97
document?
Character
2006-11-18 20:43:26 UTC
Permalink
Post by asur
Is there any way of finding out which fonts are called for in a Word 97
document?
Maybe one of the MS gurus has a better (or more technical) answer, but
a quick and dirty method (well, maybe not so quick, but definitely
dirty) would be to drag the .doc file into NOTEPAD and manually scan
for the font names, which should appear as text strings in a group
near the end of the file.

- Character
Suzanne S. Barnhill
2006-11-18 22:21:36 UTC
Permalink
You can accomplish the same thing in Word by opening the file using the
"Recover Text from Any File" setting for "Files of type" in the Open dialog.
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Post by Character
Post by asur
Is there any way of finding out which fonts are called for in a Word 97
document?
Maybe one of the MS gurus has a better (or more technical) answer, but
a quick and dirty method (well, maybe not so quick, but definitely
dirty) would be to drag the .doc file into NOTEPAD and manually scan
for the font names, which should appear as text strings in a group
near the end of the file.
- Character
zzsido
2006-11-22 15:45:54 UTC
Permalink
Post by asur
Is there any way of finding out which fonts are called for in a Word 97
document?
Here is a word macro (between the two long line), if you know how to run it:
_______________________________________________________________________
Public Sub ListFontsInDoc()
'
' FontsUsed Macro
' Macro created 05.04.21
'
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
________________________________________________________________________

It will give in a new document the Menu Names of the used fonts.
If you embed into the Normal.dot, you can run anytime as needed.

zzsido
asur
2006-11-24 23:19:01 UTC
Permalink
Good macro. One problem. It does not find fonts called for in *Word Art*.
(Apparently, the fonts called for in Word Art are kept separately. Sigh.) And
I'm looking for a font used in Word Art!

P.S. The macro has a minor syntax error in this line:

Selection.TypeText Text:="There are " & FontCount & " fonts used in the
document, as follows:"

But once that's fixed it runs fine.

Thanks
Post by zzsido
Post by asur
Is there any way of finding out which fonts are called for in a Word 97
document?
_______________________________________________________________________
Public Sub ListFontsInDoc()
'
' FontsUsed Macro
' Macro created 05.04.21
'
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
________________________________________________________________________
It will give in a new document the Menu Names of the used fonts.
If you embed into the Normal.dot, you can run anytime as needed.
zzsido
Character
2006-11-25 00:30:08 UTC
Permalink
Post by asur
Good macro. One problem. It does not find fonts called for in *Word Art*.
(Apparently, the fonts called for in Word Art are kept separately. Sigh.) And
I'm looking for a font used in Word Art!
The font name IS retained in the document. You can find it manually
(although it might take a while).

Open the document in notepad and look for the text of the word art.
"Happy Birthday" will appear as "H a p p y B i r t h d a y". The
text string immediately following will be the font name. Again, it
will appear separated like "H e l v e t i c a"

There is probably an interpretable string that defines the beginning
of a Word Art segment that would allow automation of this process; A
similar macro could then be produced or added to this one. [Well
beyond MY knowledge or ability :( ]

- Character
Post by asur
Selection.TypeText Text:="There are " & FontCount & " fonts used in the
document, as follows:"
But once that's fixed it runs fine.
Thanks
Post by zzsido
Post by asur
Is there any way of finding out which fonts are called for in a Word 97
document?
_______________________________________________________________________
Public Sub ListFontsInDoc()
'
' FontsUsed Macro
' Macro created 05.04.21
'
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
________________________________________________________________________
It will give in a new document the Menu Names of the used fonts.
If you embed into the Normal.dot, you can run anytime as needed.
zzsido
zzsido
2006-11-25 06:33:35 UTC
Permalink
Post by asur
Good macro. One problem. It does not find fonts called for in *Word Art*.
(Apparently, the fonts called for in Word Art are kept separately. Sigh.) And
I'm looking for a font used in Word Art!
Selection.TypeText Text:="There are " & FontCount & " fonts used in the
document, as follows:"
But once that's fixed it runs fine.
Thanks
The sytax error caused by Outlook Express, because of break into two lines
the originally one longer line.
I think, the WordArt embedded object (like any other OLE objects) is not act
as a simple character, therefore the macro not scan it.

I think more from this problem (embedded text-type object's scanning), but I
not give hopes of a quick result.

Zoltan
zzsido
2006-12-03 07:01:13 UTC
Permalink
Hi asur!
Is there any way of finding out which fonts are called for in a Word 97 document?
Here is a better macro. Try this.

--------------------------------------------------------------------------------

Sub ListFontsInDoc()
'
' FontsInDocList Macro
' Macro created 06.11.30 by zzsido
'
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, lngJunk As Long
Dim FoundFont As Boolean
Dim rngChar As Range
Dim strFontList As String
Dim rngStory As Word.Range
Dim oShp As Shape

FontCount = 0
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
' Iterate through all story types in the current document

For Each rngStory In ActiveDocument.StoryRanges
'Iterate through all linked stories
Do
For Each rngChar In ActiveDocument.Characters
FontName = rngChar.Font.Name
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

On Error Resume Next
Select Case rngStory.StoryType
Case 5, 6, 7, 8, 9, 10, 11
If rngStory.Characters.Count > 0 Then
For Each rngChar In rngStory.Characters
FontName = rngChar.Font.Name
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
End If

If rngStory.ShapeRange.Count > 0 Then
For Each oShp In rngStory.ShapeRange
If oShp.TextFrame.TextRange.Characters.Count > 0 Then
For Each rngChar In oShp.TextFrame.TextRange.Characters
FontName = rngChar.Font.Name
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
End If
Next
End If
Case Else
End Select
On Error GoTo 0
' Get next linked story (if any)
Set rngStory = rngStory.NextStoryRange
Loop Until rngStory Is Nothing
Next

If ActiveDocument.Shapes.Count > 0 Then
For Each oShp In ActiveDocument.Shapes
If Left(oShp.Name, 7) = "WordArt" Then
FontName = oShp.TextEffect.FontName
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
End If
Next oShp
End If

' 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 (except inserted symbols), as follows:"
Selection.TypeParagraph
Selection.TypeParagraph
For j = 1 To FontCount
Selection.TypeText Text:=FontList(j)
Selection.TypeParagraph
Next j

End Sub

--------------------------------------------------------------------------------


Regards,
zzsido

Loading...