O
OKLover
Hi, All
How do I add a paragraph mark at the end of every line with VBA ?
Regards
David
How do I add a paragraph mark at the end of every line with VBA ?
Regards
David
Fumei2 via OfficeKB.com said:What do you mean by "line"? Is each "line" terminated by a manual line break?
You could try doing a Find/Replace.
Use ^l for the Find
Use ^p for the Replace.
Why do you need VBA?
--
Gerry
.
Dear Robbins,
Thanks for your kindly answer.
Best Regards
David
[quoted text clipped - 57 lines]The following code will create a new document containing each line from the
document that was active when it is run as a separate paragraph in that
"That means each "line" terminated by
a paragraph break {ENTER} not {SHIFT+ENTER}."
A Shift+Enter is ^l in the Find/replace dialog.
An Enter (paragraph mark) is ^p
What was wrong with my suggestion? Do a find/replace changing Shift+enter to
Enter.
Find: ^l
Replace ^p
[quoted text clipped - 9 lines]Dear Robbins,
Fumei2 via OfficeKB.com said:And if you really want to use VBA...
Sub LineBreaksToParaMarks()
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = "^l"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
End With
End Sub
Gerry
"That means each "line" terminated by
a paragraph break {ENTER} not {SHIFT+ENTER}."
A Shift+Enter is ^l in the Find/replace dialog.
An Enter (paragraph mark) is ^p
What was wrong with my suggestion? Do a find/replace changing Shift+enter
to
Enter.
Find: ^l
Replace ^p
[quoted text clipped - 9 lines]Dear Robbins,David
--
Gerry
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/201006/1
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.