View Single Post
 
Old 11-06-2012, 07:37 AM
gmaxey gmaxey is offline Windows XP Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Sorry, I forgot about your "." before the tab. Try one of these. At this, I'm not sure either is very efficient, but both seem to work with your examples and with paragraphs within the enumerated items.


HTML Code:
Sub ScratchMacroII()
'A basic Word macro coded by Greg Maxey
Dim oPar As Word.Paragraph
Dim oRng As Word.Range
  For Each oPar In ActiveDocument.Range.Paragraphs
    Set oRng = oPar.Range
    oRng.Collapse wdCollapseStart
    oRng.MoveEndUntil Cset:=vbTab, Count:=wdForward
    If oRng.InRange(oPar.Range) And oRng.Start <> oRng.End And oRng.Characters.Last = "." Then
      Set oRng = oPar.Range.Words(1)
      ActiveDocument.Fields.Add oRng, wdFieldSequence, "Numbered", False
    End If
  Next oPar
End Sub
Sub ScratchMacroI()
'A basic Word macro coded by Greg Maxey
Dim oPar As Word.Paragraph
Dim oRng As Word.Range
  For Each oPar In ActiveDocument.Range.Paragraphs
    If Not oPar.Range.Words(1) Like vbCr Then
      If oPar.Range.Words.Count > 2 Then
        If oPar.Range.Words(2) = "." And oPar.Range.Words(3) = vbTab Then
          Set oRng = oPar.Range.Words(1)
          ActiveDocument.Fields.Add oRng, wdFieldSequence, "Numbered", False
        End If
      End If
    End If
  Next oPar
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote