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

TextRange.MajorityFont Property (Publisher)

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

Returns a Font object that represents the font name most in use in a text range.


expression. MajorityFont

_expression_A variable that represents a TextRange object.

Return Value



This example creates a new text box, fills it with text, checks if the font most in use is Tahoma, and if it isn't, changes the font to Tahoma.

Sub SetFontName() 
 Dim intCount As Integer 
 With ActiveDocument.Pages(1).Shapes _ 
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _ 
 Left:=100, Top:=100, Width:=100, Height:=100) _ 
 For intCount = 1 To 10 
 .InsertAfter NewText:="This is a test. " 
 Next intCount 
 If .MajorityFont <> "Tahoma" Then _ 
 .Font.Name = "Tahoma" 
 End With 
End Sub
© 2018 Microsoft