> > I have solved my delete first line problem.
> >
[quoted text clipped - 26 lines]
> It works on the first table in the document and does not check for cell
> content...
Ok. I figured out most of it so far.
Two things I need help with.
1. How can I replace only the first occurance of "^l" in each cell of the
column.
2. This code is inserting the paragraph break
Original Cell (formating marks):
Corn Hill ^l
1 or 2 BR, hrdwds, natural trim, coin-op laund in ^l
basement, off-st parking.
Cell after macro (formating marks):
Corn Hill ^p
^p
1 or 2 BR, hrdwds, natural trim, coin-op laund in ^p
basement, off-st parking.
What I want:
Corn Hill ^p
1 or 2 BR, hrdwds, natural trim, coin-op laund in ^l
basement, off-st parking.^p
Here is the code as I have it now:
Sub AddEnter()
Dim rgeCell As Range
Dim i As Long
With ActiveDocument.Tables(1).Columns(1)
For i = 1 To .Cells.Count
Set rgeCell = .Cells(i).Range
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^l"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With rgeCell
.Paragraphs(1).Range.InsertParagraphAfter
.ParagraphFormat.SpaceBefore = 0
.ParagraphFormat.SpaceAfter = 0
End With
Next
End With
End Sub
Jean-Guy Marcil - 12 Mar 2008 20:05 GMT
> Ok. I figured out most of it so far.
>
[quoted text clipped - 19 lines]
> 1 or 2 BR, hrdwds, natural trim, coin-op laund in ^l
> basement, off-st parking.^p
If I understood correctly, this should do what you want:
Sub AddEnter()
Dim rgeCell As Range
Dim i As Long
i = 1
With ActiveDocument.Tables(1).Columns(1)
For i = 1 To .Cells.Count
Set rgeCell = .Cells(i).Range
With rgeCell.Find
.Text = "^l"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceOne
End With
With rgeCell
.Paragraphs(1).Range.Font.Bold = True
End With
Next
End With
End Sub
> ^
<snip>
> > It works on the first table in the document and does not check for cell
> > content...
>
> Is there anyway to replace the text wrapping breaks with carriage returns (¶).
What are "text wrapping breaks"???
Josh O. - 12 Mar 2008 18:43 GMT
> > ^
>
[quoted text clipped - 6 lines]
>
> What are "text wrapping breaks"???
They do the same thing as a paragraph break, except distinguish a paragraph.
At the end of the line it looks like an arrow that goes down and then
90degrees left.
I am pasting a column of cells from Excel (03) to Word. Everywhere there is
an alt+enter in excel, it replaces it with text wrapping break. (the find
feature finds it as ^l). In word, Insert | Break | Text Wrapping break.
With the Show formating marks on, you can see it. (I figured this part out,
see my reply to myself).
Jean-Guy Marcil - 12 Mar 2008 19:52 GMT
> They do the same thing as a paragraph break, except distinguish a paragraph.
> At the end of the line it looks like an arrow that goes down and then
[quoted text clipped - 5 lines]
> With the Show formating marks on, you can see it. (I figured this part out,
> see my reply to myself).
Ah... I have always called those "Manual Line Break," but I see that the
official name is indeed "Text Wrapping Break" (I never noticed that option on
the Insert Break dialog becasue I have always done SHIFT-Enter in order to
insert "Text Wrapping Breaks.")
Just do a regular Find/Replace operation where you Find "^l" and Replace
them with "^p".