#1
|
|||
|
|||
Delete paragraph if bookmark contains a certain wording
Hello there,
I am looking for a VBA to delete an entire paragraph if a paragraph contains the word "not-specified". I have attached a sample doc (have highlighted the "not-specified" here). Would be cool if someone has got an idea how to solve this! |
#2
|
||||
|
||||
Try this code
Code:
Sub NonSpecificKiller() Dim aRng As Range Set aRng = ActiveDocument.Range With aRng.Find .ClearFormatting .Text = "not-specified" .MatchCase = False Do While .Execute aRng.Paragraphs(1).Range.Delete Loop End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find word, Insert Paragraph and bookmark | gattaca714 | Word VBA | 2 | 03-24-2017 09:23 PM |
Alignment of wording at the top of the line space | charles_cat | Word | 1 | 03-03-2015 02:58 AM |
Delete bookmark and paragraph which is blank | dsjk9190 | Word VBA | 2 | 01-22-2015 01:15 AM |
Calculate the coordinates of a DocVariable, Bookmark or paragraph. | MaxInCO | Word VBA | 5 | 12-11-2013 03:28 PM |
Delete Range After Bookmark? | VBA_Elfe | Word VBA | 3 | 04-05-2013 05:05 AM |