I try to combine the texts of all cells in a column into a paragraph.
For example:
Table is like :
1 this
2 is
3 great
I would like to get "this is great".
But my code below always return
" this
is
great"
Could you please help me out. Many thanks.
Code:
Sub TEST1()
Dim c As Long
Dim String1 As String
With ActiveDocument.Tables(1)
For r = 1 To .Rows.Count
String1 = String1 & .Cell(r, .Columns.Count).Range.Text
'Debug.Print String1
Next r
End With
With ActiveDocument.SelectContentControlsByTitle("text1")(1)
'.LockContentControl = False
.Range.Text = String1
'.LockContentControl = True
End With
End Sub