[austechwriter] Re: Code for "Do until end of document"
- From: Craig Hadden <CraigH@xxxxxxxxxxxxxxxxxxx>
- To: "'austechwriter@xxxxxxxxxxxxx'" <austechwriter@xxxxxxxxxxxxx>
- Date: Tue, 1 Jul 2003 10:39:53 +1000
Petra (Liverani) wrote:
> I would like to create a recorded macro in Word 97
> which stops when it gets to the end of the document.
One method that could work is the following:
Dim doc_len As Long
doc_len = Selection.StoryLength - 1 'Excludes trailing para mark.
Do While Selection.End < doc_len
.
.
.
Selection.EndKey
Loop
(Unfortunately, the indentation and line-breaks above will probably get
mangled in this e-mail. I hope the code is still legible.)
Or you could process each of the items in a collection, such as:
Dim para As Paragraph
For Each para In ActiveDocument.Paragraphs
.
.
.
Next para
Alternatively, what I often do is simply record a macro that processes a
single paragraph or whatever (and leaves the insertion point in the next
paragraph), assign a keyboard shortcut to it, and then just hold down the
shortcut and watch the macro repeatedly do its stuff!
Hope that helps,
Craig
**************************************************
To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx
To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.
To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with
"unsubscribe" in the Subject field.
To search the austechwriter archives, go to
www.freelist.org/archives/austechwriter
To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
**************************************************
Other related posts: