Characters in the Margin Next to Paragraphs

by Allen Wyatt
(last updated February 5, 2019)


Ralph writes documents that need specific alpha characters to the left of each paragraph. These letters should appear in the margin, similar to line numbers. The characters are typically the same for the entire document, meaning they don't change from paragraph to paragraph. Ralph wonders if there is a way to automatically insert these characters next to each paragraph.

There are a couple of approaches you could use to accomplish this. First, you could type the alpha character at the beginning of each paragraph and press the Tab key. Then, format the paragraph so that it uses a hanging indent that puts the first line into the left margin a bit. This could be easily done using styles that could be applied to the paragraphs.

If you have lots of paragraphs you want to do this with, it can be tedious to type the alpha character and press Tab for each paragraph. Fortunately, it is easy to create a macro that can take care of the tedium for you.

Sub FmtParagraphs()
    Dim p As Paragraph

    For Each p In ActiveDocument.Content.Paragraphs
        If p.Style = "MyAlpha" Then
            With p.Range
                .InsertBefore "R" & Chr(9)
            End With
        End If
    Next p
End Sub

The macro looks for any paragraph in the document that uses the MyAlpha style. (This assumes that MyAlpha" is the special hanging-indent style you created to effect this approach.) When it finds one, it inserts the letter "R" in front of the paragraph and then a tab character. You could easily modify this macro to check for a different style name or to add a different alpha character.

A similar approach is to define a style that utilizes a modified bulleted list. Instead of using a regular bullet, you could define the list to use the alpha character as a bullet. When applying the style to the paragraphs, the alpha character would appear automatically and you wouldn't need to type it or the tab to separate it from the main body of the paragraph.

Both approaches mentioned so far work quickly and easily for relatively simple documents. They won't work, however, if your documents include regular numbered or bulleted lists. In that case, you'll need to use a different approach—one that relies on text boxes for the placement of the alpha character.

The reason this approach may be preferable for complex documents is that it doesn't rely on styles. That means you can have a wide variety of numbered and bulleted lists in your documents, but still have the alpha characters positioned to the left of each paragraph, in the margin. Further, the text boxes can be formatted so that they are anchored to each paragraph and move with the paragraph as Word repaginates the document.

Of course, if you have a document that has 300 paragraphs in it, adding text boxes to each paragraph can be tedious, not to mention excruciating when you start to format each text box. Again, macros can help to relieve the tedium. The following macro can be used to automatically copy a selected text box to all the other paragraphs in a document.

Sub TextBoxesInMargin()
    Dim aShape As Shape
    Dim aPara As Paragraph
    Dim j As Long
    Dim shpTop As Single
    Dim shpLeft As Single
    Dim aRange As Range

    If ActiveDocument.Shapes.Count = 0 Then GoTo noTextbox
    If Selection.ShapeRange.Count <> 1 Then GoTo noTextbox

    Set aShape = Selection.ShapeRange(1)
    With aShape
        If .Type <> msoTextBox Then GoTo noTextbox
        If aShape.RelativeVerticalPosition <> wdRelativeVerticalPositionParagraph Then
            MsgBox "The text box must be positioned relative to a paragraph"
            Exit Sub
        End If
        shpTop = .Top
        shpLeft = .Left
    End With

    For Each aPara In ActiveDocument.Paragraphs
        Set aRange = aPara.Range
        If Len(aRange.Text) > 1 Then ' only non blank paragraphs
            Selection.ShapeRange.Top = shpTop
            Selection.ShapeRange.Left = shpLeft
        End If
    Next aPara
    Exit Sub

    MsgBox "Text box is not selected"
End Sub

To use the macro, format a single small text box to hold your alpha character. Make sure the text box is anchored to the paragraph that you place it beside, and that its position is correct relative to the paragraph. Once the text box looks just the way you want it to look, select it and then run the macro. The text box is copied and pasted beside every other paragraph in the document.


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 (12738) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Office 365.

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


Understanding Smart Cut and Paste

Editing is generally made easier by a feature that Word calls smart cut and paste. If you prefer, you can turn the ...

Discover More

Mail Merge and Data Source Documents become Unattached

When you create a mail merge document, you attach it to a data source that is the basis for the information to be merged ...

Discover More

Adding Horizontal Lines at the Sides of a Word

Want to add a couple of horizontal lines at the sides of a word? It can be trickier than it sounds, but there are several ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Getting Rid of Choppiness in Justified Text

Justified text doesn't always produce the best-looking results. Here's how to avoid some of the choppiness that can occur.

Discover More

Resetting Paragraph Formatting

Tired of the formatting used in a paragraph? One way to 'start over' is to make sure that the formatting is reset to its ...

Discover More

Understanding Paragraph Alignment

One of the most basic ways to align paragraphs is to set the alignment used for the text in the paragraph. Word provides ...

Discover More

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

View most recent newsletter.


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 7 + 2?

2013-11-26 07:34:03

Peter Johnson

Tables (Renee’s suggestion) – these work well as a layout tool with no visible cell borders (web pages do it all the time). To ensure alignment you need to have only one paragraph per table row (it’s a good discipline any way as it tables work best with relatively small amounts of text in each cell). However, as Allen says this only works for short documents.

Text boxes (Allen’s tip) - I used to work for a company where we used text boxes to highlight which parts in a client’s specification our service answered. Well done it looked good. However, beware when you are producing a substantial document (300 to 1,000 pages) placing them can become a nightmare as they move with the text as you edit and refine the document and are easy to inadvertently nudge out of vertical alignment. It works but it increases document production and maintenance time enormously.

Styles (Allen’s tip) – surely the easiest and most robust method provided the character is of a similar size to the body of the paragraph and does not need to have a box round it. As Allen says, you don’t need to always use the same character, although that is what Ralph needed.

Macros – (Renee avoids them) – no problem you can do what Allen suggests with a simple Replace Command.
- In the search box have ^p and in the replace box ^pR^t
This searches the document for a paragraph mark (^p) and replaces it with itself followed by a letter R and a tab character (^t). You can either change all paragraphs or step through the document changing only those you want to change (easy using the F and R shortcut keys in the Replace dialogue box).

2013-11-25 06:59:43


These are all good suggestions. I wonder what someone would use this for? It seems like it might be for someone in a specialized field, who should be using specialized software. For anything I've ever done, the exact same character at every paragraph would just be considered redundant.

2013-11-23 08:16:18


Thanks for the idea, Renee. The two-column approach was actually submitted by someone, with the immediate discount that it is very hard to align information horizontally within two columns. (Side-by-side paragraphs was an early feature of Word that hasn't been seen in almost two decades now. That would have made it very easy.)

But since you mentioned "gridlines," perhaps you didn't mean two columns but, instead, a two-column table. That would, indeed, be a good solution for short documents, perhaps those no longer than 3-5 pages. If working with a long document (100+ pages) they become more problematic by increasing the complexity of the document quite a bit.

Thanks for the ideas. (And welcome to WordTips.)


2013-11-23 07:40:53

Renee Bell

Hi Allen, I am new to your website and want to learn better ways of doing things, so I'm giving it a try.
As far as the alpha letter needing to be at the left of several paragraphs, why not just create two columns in a word document with no gridlines. The column to the left will have the alpha character? It can be copied and pasted as needed down the page. If the character needs to change,it can be easily typed over,or re-positioned. I have no experience with macros and frankly, the instructions sound complicated.(Which is why I haven't learned how to do them.) I may be in the minority though. Just my thoughts. 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.

Newest Tips

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.