共用方式為


Publisher) (TextRange.MajorityFont 屬性

會傳回代表文字範圍中最常使用之字型名稱的 Font 物件。

語法

運算式MajorityFont

表達 代表 TextRange 物件的 變數。

傳回值

Font

範例

本範例建立新的文字方塊,以文字填滿它,檢查大部分使用中的字型是否為新細明體,如果不是,則將字型變更為新細明體。

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

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應