A Double-Indent Paragraph Macro for Word 2016 - dummies

A Double-Indent Paragraph Macro for Word 2016

By Dan Gookin

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.