View Single Post
 
Old 10-08-2014, 06:31 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You also need a bit of error handling in case the first character in the document is bordered:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oChr As Range
Dim oRng As Word.Range
  For Each oChr In ActiveDocument.Range.Characters
    If oChr.Borders.OutsideLineWidth <> 0 Then
      On Error GoTo Err_Range
      If oChr.Previous.Borders.OutsideLineWidth = 0 Then
         oChr.InsertBefore ChrW(9660)
         Set oRng = oChr.Characters(1)
         With oRng.Font
           .Size = 8
           .Color = 49407
           .Superscript = True
         End With
       End If
     End If
ReEntry:
  Next
lbl_Exit:
  Exit Sub
Err_Range:
  ActiveDocument.Range.InsertBefore ChrW(9660)
  With ActiveDocument.Characters(1)
    .Borders(1).LineStyle = wdLineStyleNone
    With .Font
      .Size = 8
      .Color = 49407
      .Superscript = True
    End With
  End With
  Resume ReEntry
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote