#1
|
|||
|
|||
Delete starting and ending character of a line
How to delete starting and ending character of a line.
I have documents in which each line starts and ends with ":" How do I delete them without deleting other ":" in the document. I tried this code to remove ":" from the beginning of a line but it deletes the entire line. Sub CleanUp() Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .Text = "'" While .Execute With oRng.Paragraphs(1).Range If .Characters(1) = "'" Then .Delete End With Wend End With End Sub I recorded my "Illiterate_In_Programming" macro using home, end, backspace, delete and arrow keys but it deletes paragraph formatting. Thanks a lot!! Would you please recommend a book to learn VBA in word? |
#2
|
|||
|
|||
It could be as simple as doing
':^p' replaced with '^p' And '^p:' replaced with '^p' |
#3
|
|||
|
|||
Thank you so much!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error with macro to delete starting #) [code included] | puff | Word VBA | 1 | 04-18-2018 03:49 PM |
Delete Character on Single Line Only | Tye30 | Word VBA | 8 | 04-20-2017 08:40 PM |
Delete account and starting again? | ethelthefrog | Outlook | 0 | 02-16-2015 01:23 PM |
Delete starting number *) and delete Unneeded data in series | frustrated teacher | Word VBA | 5 | 12-07-2014 06:53 PM |
Add text to the beginning/ending of each line in word | ballmoney | Word | 1 | 01-17-2010 02:19 AM |