ドキュメント内の強調表示されたすべてのテキストを検索する検索ダイアログを準備しようとしています。これをマクロ レコーダーで作成しようとしましたが、ダイアログが表示されなかったり、テキストが見つからなかったりします。
これは私のコードです:
Sub searchForHighlights()
Dim match As Object
Set match = Application.Dialogs(wdDialogEditReplace)
match.Find.ClearFormatting
match.Find.Highlight = True
With match.Find
.Text = ""
' .Replacement.Text = "" <<< I don't want my text to be replaced
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
match.Show
End Sub
この部分は明らかに間違っています:
Set match = Application.Dialogs(wdDialogEditReplace)