Graham
Sun Oct 14 02:01:28 PDT 2007
You can record the bold/italic/underline attributes (and any others that may
be relevant, apply your character style then re-add the saved attributes eg
Sub Test455092()
Dim oRng As Range
Dim aItalic As Boolean
Dim aBold As Boolean
Dim aUline As String
For Each oRng In ActiveDocument.Sentences
With oRng.Words(1)
aItalic = .Font.Italic
aBold = .Font.Bold
aUline = .Font.Underline
.Style = ("MyStyle")
.Font.Italic = aItalic
.Font.Bold = aBold
.Font.Underline = aUline
End With
Next
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site
http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
avkokin wrote:
> There is some text, which has a first words with underline or Bold or
> Italicize. Different. How and can I employ to these words some style
> BUT these words not must to lost my underline, bold or
> italicize.Example (thanks Helmut Weber):
> Sub Test455091()
> Dim oRng As Range
> For Each oRng In ActiveDocument.Sentences
> With oRng.Words(1)
> .style = ("MyStyle")
> End With
> Next
> End Sub
> But this code change my original style for first words.
> How can I set some style to the words without loss of original
> underline or bold or other?
> Is such possible or not?