go to word (relative) number

W

wtbx

Hello,

sorry if this has been brought up again, but i can't seem to find it.

What I am looking for is a macro that would get me to a specified
number of words (which I could define everytime i run the macro) down
the document, starting to count from the current selection point, not
from the beginning of the document.

Thanks in advance for any help,

Wtbx
 
G

Graham Mayor

I am sure there are more elegant ways to do this, but the following will
work:

Dim sCount, x
sCount = 0
sCount = InputBox("Number of Words?", "Find Word", 5)
For x = 1 To sCount
Selection.Find.ClearFormatting
With Selection.Find
.Text = "<*>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Next


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