
Set ParagraphRange = Find1stRange.Paragraphs(1).RangeĮnd With 'Ending the Find1stRange. Set ParagraphRange = ActiveDocument.Range To Select the Paragraph that key word is in then see below: Sub SomeOtherSub()ĭim Find1stRange As Range, ParagraphRange As Range This will clear all the headings from the selected area and provide you normal texts. Found = TrueĮnd With 'Ending the Find1stRange.Find With Statement Get into FONT and search CLEAR ALL FORMATTING icons. 'Setting the Found range to the DelEndRangeĮnd If 'Ending the If Find1stRange. Section Breaks in Microsoft Word: Microsoft Word offers a multitude of tools that allow you to format the text you added to a document. 'Setting the Find to look for the End Word 'Setting the FindEndRange up for the remainder of the document form the end of the StartWordįindEndRange.End = 'Having these Selections during testing is benificial to test your script 'Setting the Found range to the DelStartRange StartWord = "From: = "This message has been scanned " 'Set your Start and End Find words here to cleanup the script Ever need to quickly clear all formatting from a selected group of text in Microsoft Word 2003, including any font changes, colors, text alignment, tabs, etcHere are three ways to clear text formatting, reverting the format to the Normal style. Sub SomeSub()ĭim StartWord As String, EndWord As Stringĭim Find1stRange As Range, FindEndRange As Rangeĭim DelRange As Range, DelStartRange As Range, DelEndRange As Range Summary: Three ways to clear formatting from the selected text. The Script below will search for your your two keys words and select the range from the Start of the first key word to the end of the second key word. Myrange.End = myrange.End + InStr(myrange, "This message has been scanned ") ' this will initiate the end word Execute findtext:="From: Forward:=True, Wrap:=wdFindStop 'this will initiate the start word MS Word Styles allow you to define a set of formatting commands and apply them automatically to every item in the document with that style. Program below does all of what I am looking for, except it is not able to loop through the document and do it to other messages with the same start and end position. As much as Word makes it easy to format text, if you need to apply formatting effects on the entire document, the process becomes tedious. If the word is situated within a paragraph, I would like to delete the paragraph. I need a program that can find these key words and dedicate them as the start words and then an end word as the end position and to delete all the text in between them.

HOW TO DELETE TEXT FORMATTING IN WORD PLUS
I have a huge text extract of about 1 million plus words and I want create a VBA Script which will delete all the unwanted text.įortunately I have the key words to look for and delete all the text after those key words up to a specific end point which I would like to enter. How can one go about deleting text between a start word and an end word.
