Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Inserting a Paragraph from within a Macro.

Inserting a Paragraph from within a Macro

by Allen Wyatt
(last updated April 10, 2018)

4

It is not unusual to use macros to insert new text within a document. One of the common pieces of text you may want to enter is a paragraph mark—the same as when you press Enter within a document. You can do this by using the following code within your VBA macro:

Selection.TypeParagraph

The TypeParagraph method is always used with the Selection object. As was mentioned, using TypeParagraph is the equivalent to pressing Enter in your document. This means that if anything was selected when the command is executed, the selection is replaced by the blank paragraph that the macro inserts.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10052) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Inserting a Paragraph from within a Macro.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Changing the Bullet Type

When you apply bullet formatting to paragraphs, Word allows you to choose from a variety of different bullets. If you ...

Discover More

Hiding a Stubborn Toolbar

Got a toolbar giving you problems? Here's some ideas on how to make sure it stays hidden except when you want it displayed.

Discover More

Working on Shared Templates

In many companies it is common to have standard templates accessible through the internal network. If you have templates ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (ribbon)

Repaginating in a Macro

When creating a macro that extensively processes a document, you may need to periodically force Word to repaginate the ...

Discover More

Setting the Left Indent of a Paragraph in a Macro

When using a macro to format text, you can set all sorts of attributes for paragraphs or individual characters. On ...

Discover More

Aligning a Paragraph in a Macro

If you are applying formatting from within a macro, you may want to change the alignment of various paragraphs. Here's ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is eight more than 6?

2018-04-10 11:01:27

Mandora

Trevor,

I hear your frustration, however, this is a general Tips site, not specifically a full-blown tutorial site. I have found that writing code to solve a specific problem or need is a great way to learn. Over time skills and insights build. Allen's site is just one of the ways I get informed about ways to solve VBA coding problems. I would recommend taking a basic course in VBA. It will help the "bits and pieces", such as these Tips, fall into place.


2018-04-10 07:42:11

Allen

Trevor,

There are MANY places on this site where I provide tips that use macros. I cannot, in each of those tips, explain HOW to use macros. If I did, it would be quite redundant and would make tips (such as the one above) much less useful for those who already know how to use macros.

That being said, there are a good number of resources I provide that give information on how to use macros. Let's start with what is the most obvious--the FAQ. At the right side of any page on this site (including this page) there is a link that says "WordTips FAQ." If you click that, there is a question there entitled "How Can I Use the Macros In WordTips?" The answer provides some direction, including a link to a tip about how to create macros from scratch.

Second, I provide two different e-books that are helpful in how to use the macros. You can find those here:

https://store.tips.net/T010352_Microsoft_Word_VBA_Guidebook.html
https://store.tips.net/T010057_WordTips_The_Macros.html

Those e-books are available, again, by exploring the "Helpful E-books" link at the bottom of any page.

Third, there is a search box at the upper-right of any page on the site. If you type in the word "macro" you'll get TONS of tips related to macros. You can even, if you desire, look at the Macros category, which is here:

https://wordribbon.tips.net/C0694_Macros.html

Fourth, if you are so inclined, I offer an online course about how to create macros. I don't accept new students all the time; usually about 3 times a year. You can find additional information here:

https://macrosmasterclass.com/

I hope you find this mix of free and non-free resources helpful.

-Allen



2018-04-10 03:43:24

Trevor

You consistently give tips with using Macros but you NEVER show us how to run these macros. This is the last and final time I ask you to do this. I have previously asked you to do this on no fewer than 4 occasions without any response from you. Surely this is not too much to ask!


2014-08-30 05:50:27

Sally

I don't understand any of this - could we have some background explanation please? It supposes we all know all about macros, how to make them and how to use them

Thank you!


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.