Resting Anchor

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Margin Text
(A Microsoft Word Help & Tip page by Gregory K. Maxey)

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

The purpose of this Microsoft Word Tips & Microsoft Word Help page is to show you can place headings, notes, or other text in the page margins. MVP Suzanne Barnhill offers a comprehensive discussion on this topic in her tutorial Marginal Text. One of the methods that she proposes is a margin text style. This can be fiddly (Suzanne's own words) to set up.

I second Suzanne's assessment. I tried setting up a similar style (without her tutorial) and struggled considerably. After that I thought, why not use a macro to do the dirty work? Once a basic Margin Text style is set up it is a cinch to edit and refine to an individual user's taste. After all it is a style and all styles are easily modified.

Here is the code:

VBA Script:
Sub MarginTextStyle()
Dim styleName As String
Dim oStyle As Style

  styleName = "Margin Text"
  'Create/Setup the style
  For Each oStyle In ActiveDocument.Styles
    If oStyle.NameLocal = styleName Then GoTo Setup
  Next oStyle
  ActiveDocument.Styles.Add Name:=styleName, Type:=wdStyleTypeParagraph
Setup:
  With ActiveDocument.Styles(styleName)
    .AutomaticallyUpdate = False
    .BaseStyle = ""
    .NextParagraphStyle = "Normal"
  End With
  With ActiveDocument.Styles(styleName).Font
    .Size = 8
    .ColorIndex = wdAuto
  End With
  With ActiveDocument.Styles(styleName).ParagraphFormat
    .LineSpacingRule = wdLineSpaceSingle
    .WidowControl = False
    .KeepWithNext = True
    .KeepTogether = True
    .OutlineLevel = wdOutlineLevelBodyText
    .Shading.BackgroundPatternColor = wdColorLightYellow
    With .Borders
      .OutsideLineStyle = wdLineStyleSingle
      .OutsideLineWidth = wdLineWidth050pt
      .OutsideColor = wdColorAutomatic
      .DistanceFromTop = 1
      .DistanceFromLeft = 1
      .DistanceFromBottom = 1
      .DistanceFromRight = 1
      .Shadow = False
    End With
  End With
  With ActiveDocument.Styles(styleName).Frame   
    .TextWrap = True
    .WidthRule = wdFrameExact
    'Accomodate 1.25" margin.   Adjust to suit,
    .Width = 66
    .HeightRule = wdFrameAuto
    .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
    .RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
    .HorizontalDistanceFromText = InchesToPoints(0.08)
    .VerticalDistanceFromText = InchesToPoints(0)
    .LockAnchor = False 
  End With
lbl_Exit:
  Exit Sub
End Sub

Site Note icon See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.

After running the macro your template will contain a new style "Margin Text"

margin text 1

margin text 2

That's it! I hope you have found this tips page useful and informative.

Share

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

Search my site or the web using Google Search Engine

Google Search Logo