JohnSearcy
Board Regular
- Joined
- Feb 6, 2006
- Messages
- 103
Hello, everyone -
I have this code:
Function IsFontInstalled(fontName As String) As Boolean
Dim font As Object
On Error Resume Next
Set font = CreateObject("Scripting.FileSystemObject").GetFile("C:\Windows\Fonts\" & fontName & ".ttf")
IsFontInstalled = Not font Is Nothing
On Error GoTo 0
End Function
Sub CheckFont()
Dim fontName As String
fontName = "Arial"
If IsFontInstalled(fontName) Then
MsgBox fontName & " is installed."
Else
MsgBox fontName & " is not installed."
End If
End Sub
When run it for Arial, it says it is installed. But when I put in other font names I installed, it won't recognize them. Message box will show for not installed. Reason for this? I am a novice so comments put in a simpler form would be great for me.
Thank you!
I have this code:
Function IsFontInstalled(fontName As String) As Boolean
Dim font As Object
On Error Resume Next
Set font = CreateObject("Scripting.FileSystemObject").GetFile("C:\Windows\Fonts\" & fontName & ".ttf")
IsFontInstalled = Not font Is Nothing
On Error GoTo 0
End Function
Sub CheckFont()
Dim fontName As String
fontName = "Arial"
If IsFontInstalled(fontName) Then
MsgBox fontName & " is installed."
Else
MsgBox fontName & " is not installed."
End If
End Sub
When run it for Arial, it says it is installed. But when I put in other font names I installed, it won't recognize them. Message box will show for not installed. Reason for this? I am a novice so comments put in a simpler form would be great for me.
Thank you!