View Single Post
 
Old 06-27-2019, 07:15 AM
gmaxey gmaxey is offline Windows 10 Office 2016
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

or, if there is already a tab immediately preceding the underlined text and you want to avoid duplicates use:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Font.Underline = wdUnderlineSingle
    While .Execute
      If Not Asc(oRng.Characters.First.Previous) = 9 Then
        oRng.InsertBefore vbTab
        oRng.Collapse wdCollapseEnd
      End If
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote