Word 2016 For Professionals For Dummies
Book image
Explore Book Buy On Amazon
A double-indent paragraph macro in Word 2016 modifies a paragraph's indentation, increasing both left and right attributes by half an inch. This effect could be applied by using a style, but a style sets the indentations to a specific value. When the macro is run, no matter what the current indentations are, the new values are a half-inch greater.

Here is the code for the double_indent macro:

Sub double_indent() ' ' double_indent Macro ' add half inch to both sides of the current paragraph ' pleft = Selection.ParagraphFormat.LeftIndent + InchesToPoints(0.5) pright = Selection.ParagraphFormat.RightIndent + InchesToPoints(0.5)

With Selection.ParagraphFormat

.LeftIndent = pleft

.RightIndent = pright End With

End Sub

The macro takes the current paragraph indent values and adds a half-inch to each. These values are saved in the pleft and pright variables. The current paragraph's format is then modified, reset to those values.

  • This macro cannot be faked with recorded keystrokes. You must code it directly.
  • The Ctrl+M keyboard shortcut works similarly to the double_indent macro, but it affects only the paragraph's left indent value.

About This Article

This article is from the book:

About the book author:

Dan Gookin has been writing about technology for over 150 titles years. He's written more than 130 books, including the original For Dummies book, DOS For Dummies, which soon became the world's fastest-selling computer book. Other top sellers include PCs For Dummies, Laptops For Dummies, and Android Phones For Dummies. Visit Dan at www.wambooli.com.

This article can be found in the category: