Mostrar todas las fuentes instaladas (Word) usando VBA en Microsoft Excel

Tabla de contenido

Las macros siguientes mostrarán una lista de todas las fuentes instaladas. ¡Nota! Si tiene muchas fuentes instaladas,
la macro puede dejar de responder debido a la falta de memoria disponible.

Sub ShowInstalledFonts () Dim FontNamesCtrl como CommandBarControl, FontCmdBar como CommandBar, tFormula Como cadena Dim fontName Como cadena, i As Long, fontCount As Long, fontSize As Integer Dim stdFont As String fontSize = 0 fontSize = InputBox ("Ingrese el tamaño de fuente de muestra entre 8 Y 30 ", _" Seleccionar tamaño de fuente de muestra ", 12) Si fontSize = 0 Entonces salga de Sub Si fontSize 30 Entonces fontSize = 30 Establezca FontNamesCtrl = Application.CommandBars (" Formatting "). FindControl (ID: = 1728) Si FontNamesCtrl es Nada Entonces Establecer FontCmdBar = Application.CommandBars.Add ("TempFontNamesCtrl", _ msoBarFloating, False, True) Establecer FontNamesCtrl = FontCmdBar.Controls.Add (ID: = 1728) Finalizar si Application.ScreenUpdating = False fontCount Documentos = FontNamesCtrl ..L Agregue stdFont = ActiveDocument.Paragraphs (1) .Range.Font.Name 'agregue encabezado con ActiveDocument.Paragraphs (1) .Range .Text = "Fuentes instaladas:" End With LS 2' enumere los nombres de fuente y el ejemplo de fuente en cada dos líneas Para i = 0 a FontNamesCtrl.ListCount - 1 fontName = FontName sCtrl.List (i + 1) Si i Mod 5 = 0 Entonces Application.StatusBar = "Listado de fuentes" & _ Formato (i / (fontCount - 1), "0%") & "" & _ fontName & "…" Con ActiveDocument.Paragraphs (ActiveDocument.Paragraphs.Count) .Range .Text = fontName .Font.Name = stdFont Termina con LS 1 tFormula = "abcdefghijklmnopqrstuvwxyz" Si Application.International (wdProductLanguageID) = 47 Entonces tFormula "End. Si tFormula = tFormula & UCase (tFormula) tFormula = tFormula & "1234567890" Con ActiveDocument.Paragraphs (ActiveDocument.Paragraphs.Count) .Range .Text = tFormula .Font.Name = fontName Termine con LS 2 Siguiente i ActiveDocument.Content.Font .Size = fontSize Application.StatusBar = False Si no FontCmdBar no es nada, entonces FontCmdBar.Delete Set FontCmdBar = Nothing Set FontNamesCtrl = Nothing ActiveDocument.Saved = True Application.ScreenUpdating = True Application.ScreenRefresh End Sub Private Sub LS (lCount As Integer) ' agrega lCount nuevo (s) párrafo (s) al final del documento Dim i As Integer With ActiveDo cument.Content For i = 1 To lCount .InsertParagraphAfter Next i End With End Sub

Va a ayudar al desarrollo del sitio, compartir la página con sus amigos

wave wave wave wave wave