View Single Post
  #7   Report Post  
Posted to microsoft.public.word.formatting.longdocs
Greg Maxey
 
Posts: n/a
Default Replacing style of the first word of a paragraph only

Try:
Sub Test()
Dim oPar
For Each oPar In ActiveDocument.Paragraphs
oPar.Range.Words.First.Select
Selection.MoveEnd wdCharacter, -1
With Selection
If .Font.Name = "Tahoma" And .Font.Size = "11" Then
.Style = ActiveDocument.Styles("Heading 1")
End If
End With
Next
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
"homeologica" wrote in message
...
Greg
I need to select the first word of each paragraph which be a word
formattaed
as Tahoma 11 points font . Not other first words. This code converts to
new
style paragraph marks too. I must avoid this.

So, the statement

oPar.Range.Words.First.Select

Must be changed or validated

Thank you for your valuable help.

Alejandro Fernandez