VBA – Enumerate Fonts

Just a little twist on my code from my last post (VBA – Is a Font Installed). Should you need a listing of available fonts, why not employ so simple word automation to extract a list.

'---------------------------------------------------------------------------------------
' Procedure : EnumerateFonts
' Author    : Daniel Pineault, CARDA Consultants Inc.
' Website   : http://www.cardaconsultants.com
' Purpose   : List the available fonts on the system
' Copyright : The following may be altered and reused as you wish so long as the
'             copyright notice is left unchanged (including Author, Website and
'             Copyright).  It may not be sold/resold or reposted on other sites (links
'             back to this site are allowed).
'
' Usage:
' ~~~~~~
' Call EnumerateFonts
'
' Revision History:
' Rev       Date(yyyy/mm/dd)        Description
' **************************************************************************************
' 1         2015-10-15              Initial Release
'---------------------------------------------------------------------------------------
Public Function EnumerateFonts()
    On Error GoTo Error_Handler
    Dim oWord                 As Object
    Dim i                     As Long

    Set oWord = CreateObject("Word.Application")
    For i = 1 To oWord.FontNames.Count
        Debug.Print oWord.FontNames(i)
    Next i

Error_Handler_Exit:
    On Error Resume Next
    oWord.Quit
    Set oWord = Nothing
    Exit Function

Error_Handler:
    MsgBox "The following error has occurred." & vbCrLf & vbCrLf & _
           "Error Number: " & Err.Number & vbCrLf & _
           "Error Source: EnumerateFonts" & vbCrLf & _
           "Error Description: " & Err.Description, _
           vbCritical, "An Error has Occurred!"
    Resume Error_Handler_Exit
End Function