Níže uvedená makra zobrazí seznam všech nainstalovaných písem. Poznámka! Pokud máte nainstalováno mnoho písem,
makro může přestat reagovat z důvodu nedostatku dostupné paměti.
Sub ShowInstalledFonts () Dim FontNamesCtrl As CommandBarControl, FontCmdBar As CommandBar, tFormula As String Dim fontName As String, i As Long, fontCount As Long, fontSize As Integer Dim stdFont As String fontSize = 0 fontSize = InputBox ("Enter Sample Font Size Between A 30 ", _" Vyberte velikost ukázkového písma ", 12) If fontSize = 0 Then Exit Sub If fontSize 30 Then fontSize = 30 Set FontNamesCtrl = Application.CommandBars (" Formatting "). FindControl (ID: = 1728) If FontNamesCtrl Is Nic pak nenastavujte FontCmdBar = Application.CommandBars.Add ("TempFontNamesCtrl", _ msoBarFloating, False, True) Set FontNamesCtrl = FontCmdBar.Controls.Add (ID: = 1728) End If Application.ScreenUpdating = False fontCount = F Přidat stdFont = ActiveDocument.Paragraphs (1) .Range.Font.Name 'přidat nadpis s ActiveDocument.Paragraphs (1) .Range .Text = "Instalovaná písma:" Konec s LS 2' vypíše názvy písem a příklady písem na každém druhém řádku Pro i = 0 To FontNamesCtrl.ListCount - 1 fontName = FontName sCtrl.List (i + 1) If i Mod 5 = 0 Then Application.StatusBar = "Listing font" & _ Format (i / (fontCount - 1), "0 %") & "" & _ fontName & "…" S ActiveDocument.Paragraphs (ActiveDocument.Paragraphs.Count) .Range .Text = fontName .Font.Name = stdFont Končit s LS 1 tFormula = "abcdefghijklmnopqrstuvwxyz" If Application.International (wdProductLanguageID) = 47 Then tForm Pokud tFormula = tFormula & UCase (tFormula) tFormula = tFormula & "1234567890" With ActiveDocument.Paragraphs (ActiveDocument.Paragraphs.Count) .Range .Text = tFormula .Font.Name = fontName End with LS 2 Next i ActiveDocument.Content.ont .Size = fontSize Application.StatusBar = False If Not FontCmdBar Is Nothing Then FontCmdBar.Delete Set FontCmdBar = Nothing Set FontNamesCtrl = Nothing ActiveDocument.Saved = True Application.ScreenUpdating = True Application.ScreenRefresh End Sub Private Sub LS (lCount As Integer) přidá lCount nové odstavce na konec dokumentu Dim i As Integer With ActiveDo cument.Content for i = 1 To lCount .InsertParagraphAfter Next i End With End Sub