Tālāk esošajā makro tiks parādīts visu instalēto fontu saraksts. Piezīme! Ja jums ir instalēti daudzi fonti,
makro var pārstāt reaģēt pieejamās atmiņas trūkuma dēļ. Ja tas notiek, varat izmēģināt
paraugs programmai Word vēlāk šajā dokumentā.
Sub ShowInstalledFonts () Const StartRow As Integer = 4 Dim FontNamesCtrl kā CommandBarControl, FontCmdBar kā CommandBar, tFormula As String Dim fontName As String, i As Long, fontCount As Long, fontSize As Integer fontSize = 0 fontSize = Application.InputBox ("Ievadiet paraugu Fonta lielums starp 8 un 30 ", _" Atlasīt parauga fonta lielumu ", 12,,,,, 1) If fontSize = 0 Tad iziet no Sub If fontSize 30 Tad fontSize = 30 Set FontNamesCtrl = Application.CommandBars (" Formatting "). FindControl (ID: = 1728) 'Ja trūkst fontu vadīklas, izveidojiet pagaidu CommandBar Ja FontNamesCtrl nav nekas, tad Iestatiet FontCmdBar = Application.CommandBars.Add ("TempFontNamesCtrl", _ msoBarFloating, False, True) Set FontNamesCtrl = FontControlsBar. Pievienot (ID: = 1728) Beigt, ja Application.ScreenUpdating = False fontCount = FontNamesCtrl.ListCount Workbooks.Add 'saraksta fontu nosaukumi A slejā un fontu piemērs B slejā For i = 0 To FontNamesCtrl.ListCount - 1 fontName = FontNamesCtrl.List (i + 1) Application.StatusBar = "Saraksta fonts" & _ Formāts (i / (fontCount - 1), "0 %") & "" & _ fontName & "…" Šūnas (i + StartRow, 1) .Formula = fontName With Cells (i + StartRow, 2) tFormula = " abcdefghijklmnopqrstuvwxyz "If Application.International (xlCountrySetting) = 47 Tad tFormula = tFormula &" æøå "End If tFormula = tFormula & UCase (tFormula) tFormula = tFormula &" 1234567890 ".Formula = tFormula.tformula Application. = True .Font.Size = 14 Beigt ar diapazonu ("A3"). Formula = "Fonta nosaukums:" .Font.Bold = True .Font.Size = 12 Beigt ar diapazonu ("B3") .Formula = " Fonta piemērs: ".Font.Bold = True .Font.Size = 12 Beigt ar diapazonu (" B "& StartRow &": B "& _ StartRow + fontCount) .Font.Size = fontSize Beidzas ar diapazonu (" A "& StartRow &": B "& _ StartRow + fontCount) .VerticalAlignment = xlVAl ignCenter End with Range ("A4"). Atlasiet ActiveWindow.FreezePanes = True Range ("A2"). Atlasiet ActiveWorkbook.Saved = True End Sub