CheckFont – Test whether a font is installed

' Test whether a font name and size is supported' Returns True if the font is supported, False otherwise'' If the font is supported but the size is not, it returns' the actual font size in the second argument' If the font isn't supported, it return the system font' name and size in the two arguments.Function CheckFont(fontName As String, Optional fontSize As Integer) As Boolean    On Error Resume Next    ' Create a temporary StdFont object    With New StdFont        ' Assign the proposed font name        .Name = fontName        If fontSize > 0 Then .Size = fontSize        ' Return true if font assignment succeded        CheckFont = (StrComp(fontName, .Name, vbTextCompare) = 0)        ' return actual font name and size through arguments        fontName = .Name        fontSize = .Size    End WithEnd Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: