Word 2003 Macros - Replacing words throughout a document
Posted on 2012-03-10
I'm searching for the word "recommendation" and then going to the beginning of the line where that word appears and then deleting the entire line. that's all. It's a clean up macro.
1. I would like to search for the word recommendation AND the hard return symbol. How do I code the hard return symbol into the search request?
currently it says: .Text = "recommendation"
2. What do I need to insert into the macro to detect that there are no more instances of the word recommendation (i.e. I've reached the end of the document.) here is my macro code
Currently I'm running the macro clicking on a button or using a keyboard shortcut.
' cleanUp Macro
.Text = "recommendation"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1