Auto-formatting a List of Word's Fonts with VBA

Anonymous
2019-12-05T23:32:02+00:00

I know the following with produce a list of all fonts on the system; how do I get it to format each font's name in that particular font - for example, "Times New Roman" to be formatted in Times New Roman and "Calibri" to be formatted in Calibri?

For Each aFont In FontNames

    Selection.TypeText aFont & " "

Next aFont

Thanks very much!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 322.1K Reputation points MVP Volunteer Moderator
    2019-12-06T00:27:53+00:00

    If you use

    For Each afont In FontNames

        Selection.Font.Name = afont

        Selection.TypeText afont & vbCr

    Next afont

    you will get something like

    26 people found this answer helpful.
    0 comments No comments