In MS Word, I can Ctrl-Click and select an entire sentence. I would like to
reproduce this behavior in a macro, then apply formatting. For example, I'd
like to create a macro that selects whatever sentence the insertion cursor is
currently on, and change the font.

I can do the font changes, but for the life of me can't figure out how to
select the current sentence! Help!

Re: How do I programmatically select a sentence? by Jean-Guy

Jean-Guy
Mon Nov 15 11:31:15 CST 2004

Barbra was telling us:
Barbra nous racontait que :

> In MS Word, I can Ctrl-Click and select an entire sentence. I would
> like to reproduce this behavior in a macro, then apply formatting.
> For example, I'd like to create a macro that selects whatever
> sentence the insertion cursor is currently on, and change the font.
>
> I can do the font changes, but for the life of me can't figure out
> how to select the current sentence! Help!

Try

Selection.Sentences(1).Select

to select the sentence at the cursor position.

If you can, avoid using the Selction object, as in these examples:

'_______________________________________
Sub ManipulateSentences()

'Decalre Range variable
Dim SenRange As Range

'Work with sentence at cursor position without selecting it
Set SenRange = Selection.Sentences(1)
SenRange.Font.Bold = True

'Work with second sentence in document without selecting it
Set SenRange = ActiveDocument.Sentences(2)
SenRange.Font.Italic = True

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org