Table of contents
TOC
Collapse the table of content
Expand the table of content

Font Object (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Contains font attributes (font name, font size, color, and so on) for an object.

Example

Use the Font property to return the Font object. The following instruction applies bold formatting to the selection.

Sub BoldText() 
 Selection.TextRange.Font.Bold = True 
End Sub

The following example formats the first paragraph in the active publication as 24-point Arial and italic.

Sub FormatText() 
 Dim txtRange As TextRange 
 Set txtRange = ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange 
 With txtRange.Font 
 .Bold = True 
 .Name = "Arial" 
 .Size = 24 
 End With 
End Sub

The following example changes the formatting of the Heading 2 style in the active publication to Arial and bold.

Sub FormatStyle() 
 With ActiveDocument.TextStyles("Normal").Font 
 .Name = "Tahoma" 
 .Italic = True 
 .Size = 15 
 End With 
End Sub

You can also duplicate a Font object by using the Duplicate property. The following example creates a new character style with the character formatting from the selection in addition to italic formatting. The formatting of the selection is not changed.

Sub DuplicateFont() 
 Dim fntNew As Font 
 Set fntNew = Selection.TextRange.Font.Duplicate 
 fntNew.Italic = True 
 ActiveDocument.TextStyles.Add(StyleName:="Italics").Font = fntNew 
End Sub

Methods

Name
Duplicate
GetScriptName
Grow
Reset
SetScriptName
Shrink

Properties

Name
AllCaps
Application
AttachedToText
AutomaticPairKerningThreshold
Bold
BoldBi
ContextualAlternates
DiacriticColor
ExpandUsingKashida
Fill
Glow
Italic
ItalicBi
Kerning
Ligature
Line
Name
NumberStyle
Parent
Position
Reflection
Scaling
Size
SizeBi
SmallCaps
StrikeThrough
StylisticAlternates
StylisticSets
SubScript
SuperScript
Swash
TextShadow
ThreeD
Tracking
TrackingPreset
Underline
UseDiacriticColor
© 2018 Microsoft