![]() |
#1
|
|||
|
|||
![]()
Hi all,
I hope someone can help me with this. I have some code that looks for a specific symbol in a word document, and then paste that line into a new document. If there are e.g. 3 of the same symbol next to each other, it will copy the same line 3 times, e.g: Sample list: pen book # desk ### pencil It needs to paste the following into the new word document: book 3 x desk At the moment, it is writing the word 'desk' three times underneath each other. I have had some help putting the code together, but I am now stuck again on how to streamline it. I hope it all makes sense. Code:
This is the code I have so far: With oRng.Find Do While .Execute(findText:="#") oRng.MoveEndWhile Chr(32) Set oPara = oRng.Paragraphs(1).Range oTarget.Range.InsertAfter (Trim(Replace(oPara.Text, "#", ""))) oRng.Text = "" oRng.Collapse 0 Loop End With |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
1st line of 4-line poem centrally aligned; how to get lines 2-4 to start at same location on page | Swarup | Word | 6 | 09-16-2022 11:07 AM |
![]() |
rgm60527 | Mail Merge | 2 | 02-22-2022 11:13 AM |
![]() |
ozzzy | Word | 2 | 01-21-2021 06:41 AM |
Usability of space between final line of body text and footnote separator line | Swarup | Word | 6 | 07-28-2018 12:51 PM |
Combining IMAP inbox and sent item folders | kenelder | Outlook | 1 | 07-17-2015 02:58 PM |