L
L
Lumina552021-03-26 10:54:39
Word
Lumina55, 2021-03-26 10:54:39

How can I make a macro that works with fonts?

Write a macro in which different font formats are sequentially sorted and displayed in Word automatically.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BasiC2k, 2021-03-26
@BasiC2k

Public Sub Font_Enumerate()
Dim i As Integer, oDoc As Document, oParagraph As Paragraph

Set oDoc = ThisDocument

oDoc.Bookmarks("\EndOfDoc").Select ' Курсор - в конец документа

For i = 1 To Application.FontNames.Count
    DoEvents
    oDoc.Content.InsertParagraphAfter
    Set oParagraph = oDoc.Paragraphs(oDoc.Paragraphs.Count)
    oParagraph.Range.Text = "Studieren, studieren, studieren (c). " & vbTab & Application.FontNames(i)
    oParagraph.Range.Sentences(1).Font.Name = Application.FontNames(i)
Next i

Set oDoc = Nothing
End Sub

From you I would only like to know - who is the author of the immortal phrase, what is generated by the code? )

T
twobomb, 2021-03-26
@twobomb

Sub мой_макрос()
    For i = 1 To FontNames.Count
         Selection.Font.Name = FontNames(i)
         Selection.TypeText (vbCr + FontNames(i))
    Next i
End Sub

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question