Quick way to delete a hard return in a word 2013 document paragraph

Source: Internet
Author: User

In a Word document, there are sometimes extra blank paragraphs. A typical feature of such a blank paragraph is that it has only one hard return, and you can delete such a blank paragraph by deleting the hard returns by using "delete" when editing the document. In fact, by writing simple VBA code, you can quickly delete such blank paragraphs by judging all the paragraphs in your code, determining whether they are 1, or deleting the paragraph. Here's how to quickly remove a hard return from a paragraph in a word 2013 document.

1, Start Word 2013 and open the document you want to work with, and there are extra blank paragraphs in the document, as shown in Figure 1.

Figure 1 documents to be processed

2, press the "ALT+F11" key to open the Visual Basic Editor, in the Project Explorer pane, right-click the project you want to work with the document, select Insert | On the shortcut menu that opens Module command, as shown in Figure 2.

Figure 2 Selecting the module command

3, at this point will insert a module, the module in the Code window to enter the program code, as shown in Figure 3. The specific program code is as follows.

Figure 3 Entering program code in the Code window

Sub Del ()

Dim Temp as Paragraph

All temp in activedocument.paragraphs

If VBA. Len (temp. Range) =1 Then

Temp. Range.delete

The If

Modified Next

The End Sub

4, press "F5" key to execute this procedure, the blank paragraph in the document is deleted directly, as shown in Figure 4.

Figure 4 A blank paragraph in the document is deleted

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.