View Single Post
 
Old 09-18-2019, 12:28 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,437
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

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oTbl As Table
Dim oRng As Range
Dim strList As String
Dim oRow As Row
Dim lngRow As Long
  For Each oTbl In ActiveDocument.Tables
    If oTbl.Style = "Protix Table" Then
      Set oRng = oTbl.Range
      oRng.Collapse wdCollapseStart
      oRng.Move wdParagraph, -1
      If Not oRng.Paragraphs(1).OutlineLevel < 10 Then
        Do
          oRng.Move wdParagraph, -1
        Loop Until oRng.Paragraphs(1).OutlineLevel < 10
      End If
    End If
    strList = oRng.Paragraphs(1).Range.ListFormat.ListString
    lngRow = 0
    For Each oRow In oTbl.Rows
      If oRow.Index > 1 Then
        lngRow = lngRow + 1
        oRow.Cells(1).Range.Text = strList & "." & lngRow
      End If
    Next oRow
  Next oTbl
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote