There is a document. In this document I need to select all first words
in every sentences. And then I need apply some style to these words.
How I can do it? Thank you.

Re: How to select in whole document all first words in sentences? by Helmut

Helmut
Sat Oct 13 05:01:14 PDT 2007

Hi avkokin,

The so called discontiguous selection
is only poorly supported by VBA,
or not supported at all.

But you don't have to select anything.

Sub Test455091()
Dim oPrg As Paragraph
For Each oPrg In ActiveDocument.Paragraphs
With oPrg.Range.Words(1)
.Font.Color = wdColorRed
.Font.Bold = True
End With
Next
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Re: How to select in whole document all first words in sentences? by avkokin

avkokin
Sat Oct 13 05:29:43 PDT 2007

On 13 , 16:01, Helmut Weber <nbhymsjxd...@mailinator.com> wrote:
> Hi avkokin,
>
> The so called discontiguous selection
> is only poorly supported by VBA,
> or not supported at all.
>
> But you don't have to select anything.
>
> Sub Test455091()
> Dim oPrg As Paragraph
> For Each oPrg In ActiveDocument.Paragraphs
> With oPrg.Range.Words(1)
> .Font.Color =3D wdColorRed
> .Font.Bold =3D True
> End With
> Next
> End Sub
>
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"

Helmut, danke sch=F6n.
But it select onlu first words in the paragraphs. How I can select
first words in each sentences?


Re: How to select in whole document all first words in sentences? by Helmut

Helmut
Sat Oct 13 12:23:44 PDT 2007

Hi Antonin,

sorry, my mistake.

Sub Test455091()
Dim oRng As Range
For Each oRng In ActiveDocument.Sentences
With oRng.Words(1)
.Font.Color = wdColorBlue
.Font.Bold = True
End With
Next
End Sub

Note, that "word" and "sentence"
(and others as well) are fuzzy concepts
of natural language and to a certain degree
not computable at all.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"