macro
Here's a macro that does something different, but it contains the Do While
..... Loop construction that you would used to repeat the operation that you
are talking about:
Dim myrange As Range
Dim myoptions As Variant
Dim ffield As FormField
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="] [", Forward:=True, MatchWildcards:=False,
Wrap:=wdFindStop) = True
Set myrange = Selection.Paragraphs(1).Range
myrange.start = myrange.start + InStr(myrange, "[")
myrange.End = myrange.start + InStrRev(myrange, "]") - 1
myoptions = Split(myrange, "] [")
myrange.start = myrange.start - 1
myrange.End = myrange.End + 1
Set ffield = ActiveDocument.FormFields.Add(Range:=myrange,
Type:=wdFieldFormDropDown)
With ffield
For i = LBound(myoptions) To UBound(myoptions)
.DropDown.ListEntries.Add myoptions(i)
Next i
.Range.InsertBefore " "
End With
Loop
End With
ActiveDocument.Protect wdAllowOnlyFormFields
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Jennifer" wrote in message
...
Hello!
I want to write a simple macro that will cut a line with a common phrase
out
of a document and paste it all at the end. How do I write one that will
search for the phrase, block the whole line, then cut it and paste it at
the
bottom? I got most of it down but I need to know how to make it repeat so
I
don't have to keep running it myself, but so that it will run through the
whole document doing it.
thank you much!
--
Jenn
|