I have a document that has plain text and I want to do some preformatting before I move it to Access. Currently, I'm in Word trying to separate the formatting into titles and text. The document has hundreds of titles and after each title small explanation text (it's an error book with explanations for one machine).
I am trying to put a unique string at the end of a lane that starts with "start-of-title" unique string.
I want to make a macro that finds that string, then goes to the end of the lane and writes " end-of-title" and do that till there are results found.
What I've done so far, and works once, is the following:
Sub test3()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "startoftitle "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" endoftitle"
End Sub
I've tried doing loops, but sadly I wasn't able to do the right syntax. The problem is that I can't make it loop till there are no results found...