Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. 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: Aligning Paragraphs in a Macro.

Aligning Paragraphs in a Macro

Written by Allen Wyatt (last updated July 28, 2018)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


3

Long-time Word users know that if you are formatting the paragraphs in your document, the Home tab of the ribbon includes some great tools you can use, or (better still) you can use styles to do the formatting. What if you have a need to align a paragraph within a macro you are writing, though? What do you do then?

Actually, aligning paragraphs within a macro is quite easy, requiring only a single line. Here's an example of how you would, for instance, center-align a paragraph:

Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

Notice that the Alignment property is set to a preset Word value, in this case wdAlignParagraphCenter. There are a number of different values you can use in your alignment:

  • wdAlignParagraphLeft to align the paragraph to the left margin.
  • wdAlignParagraphCenter to align the paragraph to the center of the print area.
  • wdAlignParagraphRight to align the paragraph to the right margin.
  • wdAlignParagraphJustify to align full lines within the paragraph with both left and right margins.

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 (12039) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Aligning Paragraphs in 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

Finding the Size of Individual Worksheets

Your workbooks can contain many, many worksheets. Which of those worksheets are the largest, however? Here's some ideas ...

Discover More

Selecting a Range of Cells Relative to the Current Cell

When processing information in a macro, you often need to select different cells relative to the currently selected ...

Discover More

Printing More than One Copy

Need to print more than a single copy of a worksheet? You can do it easily by using the printing controls provided by Excel.

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Moving the Insertion Point to the End of a Line

When writing a macro to process the text in a document, you may need to move the insertion point to the end of a line. ...

Discover More

Printing Shortcut Key Assignments from a Macro

Need to know what shortcut keys are defined? You can use a single macro command line to print out the definitions.

Discover More

Jumping to the Top of a Page

Do you want to easily jump to the top of a page in your document? You can use the Go To command to make the shift, or you ...

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}] (all 7 characters, in the sequence shown) 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 2 + 8?

2021-04-13 15:30:42

Kashmira

Thanks. Will surely try.


2021-04-13 09:28:32

Andrew

Kashmira, it's hard to tell what you're asking because the system is making all your texts look the same.

I would suggest you experiment with using tabs to get the alignment you desire--tabs let you also align to them with left, right, and center alignment.

Andy.


2021-04-12 18:56:20

Kashmira

hi
I have a paragraphs like these
1 55050UP 4009 USN 4599 CAS 1 13 I 182 100 3500 09APR21 0 0 B F
COMMENTS: TORONTO CA MIX SC123456
1 55050UP 4009 USN 4599 CAS 1 13 I 182 100 3500 09APR21 0 0 B F
COMMENTS: TORONTO CA MIX SC123456

I want 1st line aligned to 2nd line, I tried Justify , left position. But it is not working.
I want aligned like below. Any suggestion. I get this only when I do manually aligning paragraph to Justify.
Also I want automatically adding space between 2 paragraph 6 point , but keeping 2 line together. 6 point.

1 55050UP 4009 USN 4599 CAS 1 13 I 182 100 3500 09APR21 0 0 B F
COMMENTS: TORONTO CA MIX SC123456

1 55050UP 4009 USN 4599 CAS 1 13 I 182 100 3500 09APR21 0 0 B F
COMMENTS: TORONTO CA MIX SC123456


Thanks


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.

Videos
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.