![]() |
#2
|
||||
|
||||
![]()
I prefer to load this type of information to a table so it can be sorted and formatted more easily. Try this variation on the code.
Code:
Sub InsertAllFontSamples() 'Inserts samples of all installed fonts into the current file Dim strFont As Variant, sText As String, oTbl As Table, aRng As Range, oRow As Row sText = "The quick brown fox jumped over the lazy dog. 12345 67890" Application.ScreenUpdating = False Set aRng = Selection.Range Set oTbl = ActiveDocument.Tables.Add(Range:=aRng, numrows:=1, numcolumns:=2) oTbl.cell(1, 1).Range.Text = "Font" oTbl.cell(1, 2).Range.Text = "Sample" oTbl.Range.Style = wdStyleNormal oTbl.Columns(1).PreferredWidthType = wdPreferredWidthPercent oTbl.Columns(1).PreferredWidth = 30 oTbl.Columns(2).PreferredWidth = 70 For Each strFont In Application.FontNames Set oRow = oTbl.Rows.Add oRow.Cells(1).Range.Text = strFont oRow.Cells(2).Range.Text = sText oRow.Cells(2).Range.Font.Name = strFont Next strFont oTbl.ApplyStyleHeadingRows = True oTbl.SortAscending Application.ScreenUpdating = True MsgBox "Macro finished!" End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
list of fonts, spacing issues, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cannot print specific fonts | Head | Word | 4 | 06-23-2018 06:03 PM |
![]() |
kissingfrogs2003 | Word VBA | 3 | 08-30-2016 11:42 AM |
Code to Print page 2 only | Bursal | Word VBA | 1 | 05-05-2016 09:58 PM |
How to print a line of text with all available fonts in the same document | electrocad | Word VBA | 1 | 10-17-2015 04:53 AM |
vba Code to Print Spreadsheet to PDF | OTPM | Excel Programming | 3 | 05-25-2011 08:22 AM |