From: OKLover on 2 Jun 2010 05:23 Wow ~ Robbins, you are so cool. Yes! It can do that, but does it possible to loop each line to check via VBA code? Many thanks David "Doug Robbins - Word MVP" wrote: > Saving the document as a .txt file can be used to do that. > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "OKLover" <OKLover(a)discussions.microsoft.com> wrote in message > news:67FA1E38-9A27-46E1-97E2-11718A67A402(a)microsoft.com... > > sorry... updated informationas below: > > > > It should be each line as a paragraph. That means each "line" terminated > > by > > a paragraph break {ENTER} not {SHIFT+ENTER}. > > > > > > Many Thanks > > > > David > > > > "Fumei2 via OfficeKB.com" wrote: > > > >> 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? > >> > >> OKLover wrote: > >> >Hi, All > >> > > >> >How do I add a paragraph mark at the end of every line with VBA ? > >> > > >> >Regards > >> > > >> >David > >> > >> -- > >> Gerry > >> > >> Message posted via http://www.officekb.com > >> > >> . > >>
From: Doug Robbins - Word MVP on 2 Jun 2010 06:26 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 document Dim source As Document, target As Document Dim numlines As Long Set source = ActiveDocument Set target = Documents.Add On Error GoTo LastLine With source .Activate Selection.HomeKey wdStory Do While .Bookmarks("\line").Range.End <> .Range.End target.Range.InsertAfter .Bookmarks("\line").Range.Text & vbCr .Bookmarks("\line").Range.Cut Loop End With LastLine: target.Range.InsertAfter source.Bookmarks("\line").Range.Text -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "OKLover" <OKLover(a)discussions.microsoft.com> wrote in message news:EEA452ED-7FE0-4615-A950-A26F89AFCA47(a)microsoft.com... > Wow ~ Robbins, you are so cool. > > Yes! It can do that, but does it possible to loop each line to check via > VBA > code? > > > Many thanks > > David > > > "Doug Robbins - Word MVP" wrote: > >> Saving the document as a .txt file can be used to do that. >> >> -- >> Hope this helps. >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> services on a paid consulting basis. >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> "OKLover" <OKLover(a)discussions.microsoft.com> wrote in message >> news:67FA1E38-9A27-46E1-97E2-11718A67A402(a)microsoft.com... >> > sorry... updated informationas below: >> > >> > It should be each line as a paragraph. That means each "line" >> > terminated >> > by >> > a paragraph break {ENTER} not {SHIFT+ENTER}. >> > >> > >> > Many Thanks >> > >> > David >> > >> > "Fumei2 via OfficeKB.com" wrote: >> > >> >> 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? >> >> >> >> OKLover wrote: >> >> >Hi, All >> >> > >> >> >How do I add a paragraph mark at the end of every line with VBA ? >> >> > >> >> >Regards >> >> > >> >> >David >> >> >> >> -- >> >> Gerry >> >> >> >> Message posted via http://www.officekb.com >> >> >> >> . >> >>
From: OKLover on 3 Jun 2010 07:03 Dear Robbins, Thanks for your kindly answer. Best Regards David "Doug Robbins - Word MVP" wrote: > 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 > document > > Dim source As Document, target As Document > Dim numlines As Long > Set source = ActiveDocument > Set target = Documents.Add > On Error GoTo LastLine > With source > .Activate > Selection.HomeKey wdStory > Do While .Bookmarks("\line").Range.End <> .Range.End > target.Range.InsertAfter .Bookmarks("\line").Range.Text & vbCr > .Bookmarks("\line").Range.Cut > Loop > End With > LastLine: > target.Range.InsertAfter source.Bookmarks("\line").Range.Text > > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "OKLover" <OKLover(a)discussions.microsoft.com> wrote in message > news:EEA452ED-7FE0-4615-A950-A26F89AFCA47(a)microsoft.com... > > Wow ~ Robbins, you are so cool. > > > > Yes! It can do that, but does it possible to loop each line to check via > > VBA > > code? > > > > > > Many thanks > > > > David > > > > > > "Doug Robbins - Word MVP" wrote: > > > >> Saving the document as a .txt file can be used to do that. > >> > >> -- > >> Hope this helps. > >> > >> Please reply to the newsgroup unless you wish to avail yourself of my > >> services on a paid consulting basis. > >> > >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > >> > >> "OKLover" <OKLover(a)discussions.microsoft.com> wrote in message > >> news:67FA1E38-9A27-46E1-97E2-11718A67A402(a)microsoft.com... > >> > sorry... updated informationas below: > >> > > >> > It should be each line as a paragraph. That means each "line" > >> > terminated > >> > by > >> > a paragraph break {ENTER} not {SHIFT+ENTER}. > >> > > >> > > >> > Many Thanks > >> > > >> > David > >> > > >> > "Fumei2 via OfficeKB.com" wrote: > >> > > >> >> 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? > >> >> > >> >> OKLover wrote: > >> >> >Hi, All > >> >> > > >> >> >How do I add a paragraph mark at the end of every line with VBA ? > >> >> > > >> >> >Regards > >> >> > > >> >> >David > >> >> > >> >> -- > >> >> Gerry > >> >> > >> >> Message posted via http://www.officekb.com > >> >> > >> >> . > >> >>
From: Fumei2 via OfficeKB.com on 3 Jun 2010 15:45 "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 OKLover wrote: >Dear Robbins, > >Thanks for your kindly answer. > >Best Regards > >David > >> 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 >[quoted text clipped - 57 lines] >> >> >> > >> >> >> >David -- Gerry Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/word-programming/201006/1
From: Fumei2 via OfficeKB.com on 3 Jun 2010 15:48 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 Fumei2 wrote: >"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 > >>Dear Robbins, >> >[quoted text clipped - 9 lines] >>> >> >> > >>> >> >> >David > -- Gerry Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/word-programming/201006/1
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Opening a user form Next: TextBox control not enabled with protection on |