Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub AutoFind()
- On Error GoTo myErrorHandler
- Selection.HomeKey Unit:=wdStory
- Dim theDialog As dialog
- Set theDialog = Application.Dialogs(wdDialogEditReplace)
- theDialog.Find = "the"
- theDialog.replace = "an"
- theDialog.Show
- End Sub
- Sub TestMacro()
- Selection.Find.ClearFormatting
- Selection.Find.Replacement.ClearFormatting
- With Selection.Find
- .Text = "test find field"
- .Replacement.Text = "test replace field"
- .Forward = True
- .Wrap = wdFindContinue
- .Format = False
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- CommandBars.FindControl(ID:=313).Execute
- end sub
- SendKeys "^h" ' Hack to obtain "Dialogs(wdDialogEditReplace).Show" modelessly.
- ' MS Disclaimer: SendKeys is unreliable as to there being no certainty as to where focus is when called.
Add Comment
Please, Sign In to add comment