ParagraphFormat プロパティ
Microsoft Word Visual Basic リファレンス |
ParagraphFormat プロパティ
指定範囲、選択範囲、検索または置換操作、あるいはスタイルの段落設定を表す ParagraphFormat オブジェクトを取得します。値の取得および設定が可能です。
使用例
次の使用例は、現在選択されている部分の段落書式を右揃えに設定します。
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
次の使用例は、MyDoc.doc の全体の段落書式を設定します。この文書の段落は、ユーザー設定のタブ位置が 6.25 mm の位置に、行間が 1 行に設定されます。
Set myRange = Documents("MyDoc.doc").Content
With myRange.ParagraphFormat
.Space2
.TabStops.Add Position:=InchesToPoints(.25)
End With
次の使用例は、作業中の文書の [見出し 2] スタイルを変更します。このスタイルが設定された段落は、最初のタブ位置までインデントされ、行間が 1 行になります。
With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat
.TabIndent(1)
.Space2
End With
次の使用例は、作業中の文書で行間が 1 行の段落をすべて検索し、行間を 0.5 行にします。
With ActiveDocument.Content.Find
.ClearFormatting
.ParagraphFormat.Space2
.Replacement.ClearFormatting
.Replacement.ParagraphFormat.Space15
.Execute FindText:="", ReplaceWith:="", _
Replace:=wdReplaceAll
End With