Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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



 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro cannot be found or has been disabled because of Macro settin JD2 Microsoft Word Help 5 March 15th 07 04:00 AM
Pause an executing Word Macro to enter info and then Macro continu strongwell Microsoft Word Help 1 August 11th 06 06:57 PM
macro runs from keyboard, but not from macro button-why? BobW Microsoft Word Help 7 May 10th 06 11:33 PM
Running Macro from Word vs running macro from vb.net prog Simon New Users 0 July 16th 05 10:17 AM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 04:39 AM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"