Find.Replacement プロパティ (Word)

置換操作の条件を含む Replacement オブジェクトを返します。

構文

Replacement

'Find' オブジェクトを返す式。

This example removes bold formatting from the active document. The Bold property of the Font object is True for the Find object and False for the Replacement object.

With ActiveDocument.Content.Find 
 .ClearFormatting 
 .Font.Bold = True 
 With .Replacement 
 .ClearFormatting 
 .Font.Bold = False 
 End With 
 .Execute FindText:="", ReplaceWith:="", Format:=True, _ 
 Replace:=wdReplaceAll 
End With

次の使用例は、作業中の文書で単語 "Start" をすべて検索し、"End" に置き換えます。検索では、書式は無視し、大文字と小文字を区別して検索文字列 ("Start") と一致する文字列を検索します。

Set myRange = ActiveDocument.Range(Start:=0, End:=0) 
With myRange.Find 
 .ClearFormatting 
 .Text = "Start" 
 With .Replacement 
 .ClearFormatting 
 .Text = "End" 
 End With 
 .Execute Replace:=wdReplaceAll, _ 
 Format:=True, MatchCase:=True, _ 
 MatchWholeWord:=True 
End With

関連項目

Find オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。