Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2021, 05:54 AM
Matt C's Avatar
Matt C Matt C is offline Check the font attached to a template's "Normal" style and report if it's not installed Windows 10 Check the font attached to a template's "Normal" style and report if it's not installed Office 97-2003
Advanced Beginner
Check the font attached to a template's "Normal" style and report if it's not installed
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Default

Firstly, huge apologies to Andrew and Paul for not thanking them for the replies. Work got the better of me and I missed the reply notifications. The above is useful, many thanks.

I'd like to take it a step further for another area of the VBA. To illustrate, please see the adapted code below with commenting.

Quote:
Sub FontCheckAndSubstitute()
'
' Check for "Blobby" font and apply it to "Normal" style.
' If "Blobby" font is not installed, substitute with something from a set list of alternatives.
' If alternatives are not installed, let Word substitute with nearest common font
'
Dim lFound As Boolean
Dim font As Variant

font = "Blobby"
Let lFound = False

' Check for "Blobby" font



For Each aFont In Application.FontNames
If aFont = font Then
Let lFound = True
End If

Next aFont

' If "Blobby" font isn't installed...

If lFound = False Then
Call MsgBox("For best results, please install the font '" & font & "'. Word will substitute with the closest match." & vbCrLf & vbCrLf & _
"Pres OK to continue.", vbOKOnly + vbExclamation, "Required Font Missing")

' Need help here:

' Substitute "Blobby" with a font from a list of alternatives (e.g. "Jelly", "Spongey", "Bouncey")
' Or let Word substitute with a common font if alternatives are not installed (e.g. "Courier New")

End If


' Apply "Blobby" or substituted font to Normal style

With ActiveDocument.Styles("Normal").font
.Name = font '<------ Is this correct?
.Size = 12
End With

End Sub
Thanks, folks.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Changes have been made that affect the global template, Normal.dotm. ..." DBlomgren Word 11 12-18-2017 12:54 PM
Setting Font Color and Style "permanently" wings1080 Word 5 12-19-2014 08:44 AM
Check the font attached to a template's &quot;Normal&quot; style and report if it's not installed Documents hung up, Word won't close due to "Changes made..to global template Normal.dotm" pagskg Word 2 07-23-2014 12:54 PM
Style doesn't enforce "Do not check spelling" Jennifer Murphy Word 7 01-30-2012 12:51 AM
Check the font attached to a template's &quot;Normal&quot; style and report if it's not installed "Table of content" based on "Normal Style" behavior!!!! Jamal NUMAN Word 4 07-08-2011 04:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft