Fastest way to change vbCr to vbCrLf?

B

Benjamino5

I have a batch of strangely corrupted Word files. Most of the paragraph marks
are actually just chr(13) a.k.a. vbCr, not the full combination vbCrLf,
a.k.a. vbCrLf.

This matters because when I save the Word files as RTF (which I have to do),
the chr(13)-only "paragraph marks" just disappear.

I thought I could do a find-and-replace for chr(13), replacing it with the
combo of chr(13) and chr(10), but Word's weird handling of this made it fail.

Instead, I'm going character by character, which takes a very LONG time:

Sub CharTest()
Dim x As Integer
Dim chars As Characters
Set chars = ActiveDocument.Characters
For x = 1 To ActiveDocument.Characters.Count
If chars.Item(x) = Chr(13) Then
chars.Item(x).text = Replace(chars.Item(x), Chr(13), Chr(13) &
Chr(10))
End If
Next x
End Sub

What would be a better way to do this?

Thanks a lot,
Ben
 
B

Benjamino5

David,

Thank you! The tip at the bottom of the thread about using wildcards and
replacing "^13" with "^p" did the job magnificently--and instantly.

Ben
 

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