How to change sign of paragraph on the space?

A

avkokin

There is a document Word (see example: http://www.box.net/shared/luo0o336so).
Some sentenses in paragraphs are broken off by paragraph signs, other
paragraphs is ok.
The problem - I need to join the broken of lines of each paragraph,
but thus not uniting normal paragraphs.
The end of the normal paragraph consists of a point and a paragraph
sign.
The end of a line of the broken off paragraph consists of a paragraph
sign.
Here the code which I try to use, but has stopped on replacement
operation. Correct me please and explain what is my wrong. Thanks.
Code:

Sub delpar_3()
Dim sPar As String
Dim par As Paragraph
Dim i As Integer
i = 0
For Each par In ActiveDocument.Paragraphs
If Right(par, 2) = Chr(46) & Chr(13) Then
i = i + 1
Else
If Right(par, 1) = Chr(13) Then
par = Replace(par, Chr(13), " ") 'Here is error!!!
End If
Next par
End Sub
 
H

Helmut Weber

Hi Anton,

like that:

Sub delpar_3()
Dim sPar As String
Dim par As Paragraph
Dim i As Integer
i = 0
For Each par In ActiveDocument.Paragraphs
If Right(par, 2) = Chr(46) & Chr(13) Then
i = i + 1
Else
If Right(par, 1) = Chr(13) Then
par.Range.Text = Replace(par.Range.Text, Chr(13), " ") 'Here is
error!!!
End If
End If
Next par
End Sub
 
A

avkokin

Hi Anton,

like that:

Sub delpar_3()
Dim sPar As String
Dim par As Paragraph
Dim i As Integer
i = 0
For Each par In ActiveDocument.Paragraphs
   If Right(par, 2) = Chr(46) & Chr(13) Then
       i = i + 1
   Else
      If Right(par, 1) = Chr(13) Then
         par.Range.Text = Replace(par.Range.Text, Chr(13), " ") 'Here is
error!!!
      End If
   End If
Next par
End Sub

Thank you very much. It's work!
 

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