Hi Chris,
What is the difference between word paragraph mark
and line break (chr(13))?
A line break is chr(11) and looks like the arrow
on an enter key. You type it with [shift return].
A paragraph mark looks like Chr(182) ¶.
What you see here, though, are not paragraph marks,
they characters only look that way.
Sample Text:
This is paragraph one.¶
This is paragraph two.¶
If you got two paragraphs and replace
the first paragraph mark by anything
but a paragaph mark, the two paragraphs will become one.
So i search for paragraph marks "^p" and replace it with my tag <br>, right?
So the problem that my whole document will be formated as the last
headerstyle i
assigned is that i remove all paragraph marks first??
Yes.
Use a character style instead of a paragraph style.
Or apply formatting directly, like this:
Sub Macro11()
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = True
.MatchWildcards = True
.Text = "(\<U1\>)(*)(\</U1\>)"
.Replacement.Text = "\2"
.Replacement.Font.Color = wdColorRed
.Execute Replace:=wdReplaceAll
End With
End Sub
Still better:
Sub Macro11a()
Dim rTmp As Range
Set rTmp = ActiveDocument.Range
With rTmp.Find
.Text = "(\<U1\>)(*)(\</U1\>)"
.MatchWildcards = True
.Replacement.Text = "\2"
.Replacement.Font.Color = wdColorBlue
.Execute Replace:=wdReplaceAll
End With
End Sub
As when creating a new range-object to search
you don't have to worry about clearformatting etc.
Keep on.
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"