Select last word of paragraph

T

Tony Jollans

Depending on what you mean by 'word' this is probably harder than you might
imagine. Something like this should normally work ...

Dim ParaRef As Paragraph
Dim WordNum As Long

' Get a reference to your paragraph, for example
Set ParaRef = ActiveDocument.Range.Paragraphs(1)

' Scan backwards, avoiding para mark and punctuation
For WordNum = ParaRef.Range.Words.Count To 1 Step -1
If Len(ParaRef.Range.Words(WordNum)) > 1 Then
ParaRef.Range.Words(WordNum).Select
Exit For
End If
Next
 
J

Jezebel

Depends on your definition of 'word' -- if you use VBA's, then --

selection.Range.Paragraphs(1).Range.Words(selection.Range.Paragraphs(1).Range.Words.Count).Select
 

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