replace + format

M

Mark Daring

My macro replaces all manual line breaks (Chr(11)) within a paragraph.
The problem is that for example all bold words turn into plain after the
makro was applied.

How can I preserve my formatting???

Thx.




My Makro:

Sub replace11()
Set mr = Selection.Range
mr.Expand (wdParagraph)
mr.Text = Replace(mr.Text, Chr(11), Chr(32))
End Sub
 
M

Mark Daring

Just accidently came across it.

That will do it:

Sub findreplace11()
Set mr = Selection.Range
mr.Expand (wdParagraph)
With mr.Find
.ClearFormatting
.Text = Chr(11)
With .Replacement
.ClearFormatting
.Text = Chr(32)
End With
.Execute Replace:=wdReplaceAll
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top