List maker
Here is a macro that will produce a list of all of the installed fonts.
- Open Word.
- Use Alt+F11 to open the Visual Basic editor.
- Choose Insert>Module from the Menu.
- Copy and Paste this code in the module.
- Return to Word and go to: Tools>Macro>Macros.
- Select and run "InstalledFonts".
Sub InstalledFonts()
Dim F As Integer
Dim InstalledFonts As Table
'Open a fresh document
Set FreshDoc = Documents.Add
'Create a table and define the header
Set InstalledFonts = FreshDoc.Tables.Add(Selection.Range, FontNames.Count + 1, 2)
With InstalledFonts
.Borders.Enable = False
.Cell(1, 1).Range.Font.Name = "Arial"
.Cell(1, 1).Range.Font.Bold = 1
.Cell(1, 1).Range.InsertAfter "Font Name"
.Cell(1, 2).Range.Font.Bold = 1
.Cell(1, 2).Range.InsertAfter "Example"
End With
'Loop through all the fonts and add them to the table
For F = 1 To FontNames.Count
With InstalledFonts
.Cell(F + 1, 1).Range.Font.Name = "Arial"
.Cell(F + 1, 1).Range.Font.Size = 10
.Cell(F + 1, 1).Range.InsertAfter FontNames(F)
.Cell(F + 1, 2).Range.Font.Name = FontNames(F)
.Cell(F + 1, 2).Range.Font.Size = 10
.Cell(F + 1, 2).Range.InsertAfter "ABCDEFG abcdefg 1234567890 &$@"
End With
Next F
'Sort the names of the fonts
InstalledFonts.Sort SortOrder:=wdSortOrderAscending
End Sub
Also see a more sophisticated macro using Excel from Erlandsen Data Consulting: Display all installed fonts (Excel)
See all Topics word
No comments:
Post a Comment