bottom
Great WordTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > WordTips Home > Macros > VBA Examples > Aligning Paragraphs in a Macro

Aligning Paragraphs in a Macro

Summary: Using a macro to format your document (or portions of your document) is not all that uncommon. If you want your macro to change paragraph alignment within the document, there are just a couple of properties you need to focus upon. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)

If you are writing a VBA macro, you may want to apply paragraph alignment formatting within your document. To do so, you use the Alignment property, as follows:

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.

Tip #827 applies to Microsoft Word versions: 97 | 2000 | 2002 | 2003 | 2007


Create and Merge! Using Word's mail merge tool you can quickly and easily combine data from a variety of data sources to create great individualized documents that incorporate your data in ways that you control. WordTips: Mail Merge Magic is an invaluable source for learning how to harness the full power of Word's mail merging capabilities.
 
Check out WordTips: Mail Merge Magic today!

Helpful Links

Ask a Word Question
Make a Comment

Tips.Net Home
Tips.Net Store

WordTips FAQ
WordTips Premium

Learn Access Now

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
WordTips Site

 

Great Info!

Get tips like this every week in WordTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)