Resting Anchor

The Anchorage

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

Add "Fancy" (or compound) Lines in Word 2007
(A Microsoft Word Help & Tip page by Gregory K. Maxey)


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!

The purpose of this Microsoft Word Tips & Microsoft Word Help page is show you how you can restore the "fancy" (or compound) line shape capability in Word 2007 documents.

The following depicts a compound line shape drawn in using Word 2003.

fancy_line_1 fancy_line_2
1 2
fancy_line_3 fancy_line_4
3 4

For whatever reason, the developers of Word 2007 apparently didn't like that feature and tried to take it away. When you draw a line in Word 2007 and attempt those same steps you are met with a disabled style attribute box.

Site Note IconNote:  To insert a basic line in Word 2007, use Insert tab>Illustrations Group>Shapes>Lines. 


Fortunately, the developers were not very thorough in their attempt to execute this feature. A drawing line inserted with VBA can include style elements including a "fancy" line.

VBA Script:
Sub InsertFancyLineWithVBA()
Dim oShp As Word.Shape
  Set oShp = ActiveDocument.Shapes.AddLine(25, 25, 100, 100)
  With oShp.Line
    .Style = msoLineThickBetweenThin
    .Weight = 6
  End With
  Exit Sub
End Sub

The line inserted using the VBA procedure can fully formatted using the now enabled style attribute.

Site Note IconNote:  Lines drawn with Word 2003 and pasted in a Word 2007 document behave similarly.


Through a bit of VBA manipulation any of the three basic line shapes (basic, arrow, double arrow) drawn with the user interface in Word2007 can be converted by selecting the line and running the following macro. Lines converted in this manner can then be fully formatted using the "Format AutoShape..." style attribute.

VBA Script:
Sub DuplicateAndReplaceLine()
'Declare variables
Dim oShp As Word.Shape
Dim bHFlip As Boolean
Dim bVFlip As Boolean
Dim oShpNew As Word.Shape
Dim i As Long, j As Long, k As Long, l As Long
Dim lngBAL As Long, lngBAS As Long, lngBAW As Long
Dim lngEAL As Long, lngEAS As Long, lngEAW As Long
Dim lngStyle As Long
Dim pWeight As String
  'Get the cooridates and attributes of the selected line
  Set oShp = Selection.ShapeRange(1)
  i = oShp.Left
  j = oShp.Top
  k = oShp.Height
  l = oShp.Width
  bHFlip = oShp.HorizontalFlip
  bVFlip = oShp.VerticalFlip
  With oShp.Line
    lngStyle = .Style
    pWeight = .Weight
    lngBAL = .BeginArrowheadLength
    lngBAS = .BeginArrowheadStyle
    lngBAW = .BeginArrowheadWidth
    lngEAL = .EndArrowheadLength
    lngEAS = .EndArrowheadStyle
    lngEAW = .EndArrowheadWidth
  End With
  'Delete the line
  'Recreate the line as a fully formattable VBA inserted line
  Set oShpNew = ActiveDocument.Shapes.AddLine(i, j, i + 72, j)
  With oShpNew
    .Left = i
    .Top = j
    .Width = l
    .Height = k
    If .HorizontalFlip <> bHFlip Then .Flip (msoFlipHorizontal)
    If .VerticalFlip <> bVFlip Then .Flip (msoFlipVertical)
    With .Line
      .Style = lngStyle
      .Weight = pWeight
      .BeginArrowheadLength = lngBAL
      .BeginArrowheadStyle = lngBAS
      .BeginArrowheadWidth = lngBAW
      .EndArrowheadLength = lngEAL
      .EndArrowheadStyle = lngEAS
      .EndArrowheadWidth = lngEAW
    End With
  End With
  Exit Sub
End Sub

Site Note IconNote:  In the Word 2010 drawing object model this feature is restored using the line style "Compound Line" attribute.

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



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

Do you want to make a payment for consulting work or donate to help support this site?

PayPal is a safe, easy way to pay online.

Use the appropriate currency "Donate" button to make a payment or donation.

Search my site or the web using Google Search Engine

Google Search Logo