detecting end of document / Find command

T

troubadour

Is there a general way in a macro to detect that the end of the document is
reached ?
Actually i am trying to do so that a Find command automaticaly stops at the
end of the document (not trying to do the same search from the top of my
document, that becomes completely messed up :)

Thank you

Troubadour
 
D

Doug Robbins

Like this

' Macro to round all numbers in a document

' Macro created 19/7/00 by Doug Robbins

'

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="[0-9]{1,}.[0-9]{3,}", MatchWildcards: =
True, Wrap:=wdFindContinue, Forward:=True) = True
Selection.Range.Text = Round(Selection.Range.Text, 2)
Loop
End With

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top