Makroerne herunder viser en liste over alle installerede skrifttyper. Bemærk! Hvis du har mange skrifttyper installeret,
makroen kan stoppe med at reagere på grund af mangel på tilgængelig hukommelse.
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 8 Og 30 ", _" Select Sample Font Size ", 12) If fontSize = 0 Exit Sub If fontSize 30 Then fontSize = 30 Set FontNamesCtrl = Application.CommandBars (" Formatting "). FindControl (ID: = 1728) If FontNamesCtrl Is Intet Indstil derefter FontCmdBar = Application.CommandBars.Add ("TempFontNamesCtrl", _ msoBarFloating, False, True) Indstil FontNamesCtrl = FontCmdBar.Controls.Add (ID: = 1728) End If Application.ScreenUpdating = False fontCount = FontNamesCtrl.L. Tilføj stdFont = ActiveDocument.Paragraphs (1) .Range.Font.Name 'tilføj overskrift Med ActiveDocument.Paragraphs (1) .Range .Text = "Installerede skrifttyper:" End With LS 2' list font names and font example on every other line For i = 0 Til FontNamesCtrl.ListCount - 1 fontName = FontName sCtrl.List (i + 1) Hvis i Mod 5 = 0 derefter Application.StatusBar = "Listing font" & _ Format (i / (fontCount - 1), "0 %") & "" & _ fontName & "…" Med ActiveDocument.Paragraphs (ActiveDocument.Paragraphs.Count) .Range .Text = fontName .Font.Name = stdFont End With LS 1 tFormula = "abcdefghijklmnopqrstuvwxyz" If Application.International (wdProductLanguageID) = 47 Herefter tFormula = "æåFormula" If 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.Font .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) ' tilføjer lTæl nye afsnit i slutningen af dokumentet Dim i As Integer With ActiveDo cument.Content For i = 1 To lCount .InsertParagraphAfter Next i End with End Sub