TextRange.MajorityFont プロパティ (Publisher)

テキスト範囲で最も使用されているフォント名を表す Font オブジェクトを取得します。

構文

MajorityFont

TextRange オブジェクトを表す変数。

戻り値

Font

次の使用例は、新しいテキスト ボックスを作成してテキストを挿入し、最も使用されているフォントが Tahoma かどうかを調べ、Tahoma でない場合は Tahoma に変更します。

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 のサポートおよびフィードバックを参照してください。