Visualizza tutti i caratteri installati (Word) utilizzando VBA in Microsoft Excel

Sommario

Le macro seguenti mostreranno un elenco di tutti i font installati. Nota! Se hai molti font installati,
la macro potrebbe bloccarsi a causa della mancanza di memoria disponibile.

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 And 30", _ "Seleziona dimensione carattere di esempio", 12) Se fontSize = 0 Quindi esci da Sub If fontSize 30 Quindi fontSize = 30 Imposta FontNamesCtrl = Application.CommandBars ("Formatting").FindControl (ID: = 1728) If FontNamesCtrl Is Nothing Then Set FontCmdBar = Application.CommandBars.Add("TempFontNamesCtrl", _ msoBarFloating, False, True) Set FontNamesCtrl = FontCmdBar.Controls.Add(ID:=1728) End If Application.ScreenUpdating = False fontCount = FontNamesCtrl.ListCount Documenti Aggiungi stdFont = ActiveDocument.Paragraphs(1).Range.Font.Name ' aggiungi intestazione With ActiveDocument.Paragraphs(1).Range .Text = "Caratteri installati:" End With LS 2 ' elenca i nomi dei font e gli esempi di font su ogni riga Per i = 0 a 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 & "… " Con ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count).Range .Text = fontName .Font.Name = stdFont End With LS 1 tFormula = "abcdefghijklmnopqrstuvwxyz" If Application.International(wdProductLanguageID) = 47 Then tFormula & "æ tFormula = tFormula If tFormula = tFormula & UCase(tFormula) tFormula = tFormula & "1234567890" With ActiveDocument.Paragraphs(ActiveDocument.Paragraphs.Count).Range .Text = tFormula .Font.Name = fontName Termina con LS 2 Avanti i ActiveDocument.Content.Font .Size = fontSize Application.StatusBar = False Se non FontCmdBar non è nulla, allora FontCmdBar.Delete Imposta FontCmdBar = Nulla Imposta FontNamesCtrl = Nulla ActiveDocument.Saved = True Application.ScreenUpdating = True Application.ScreenRefresh End Sub Private Sub LS(lCount As Integer) ' aggiunge lConta nuovi paragrafi alla fine del documento Dim i As Integer With ActiveDo cument.Content For i = 1 To lCount .InsertParagraphAfter Next i End With End Sub

Aiuterete lo sviluppo del sito, condividere la pagina con i tuoi amici

wave wave wave wave wave