View Single Post
 
Old 05-09-2017, 07:25 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2016
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

How about:

Code:
Sub subNumberTableColumns()
Dim oTbl As Table
Dim lngIndex As Integer
Dim oRng As Range
  On Error GoTo Error_subNumberTableColumns
  If Selection.Information(wdWithInTable) Then
  Set oTbl = Selection.Tables(1)
  For lngIndex = 1 To oTbl.Rows.Count - 1
    Set oRng = oTbl.Cell(lngIndex + 1, 1).Range
    oRng.InsertBefore lngIndex & ". "
  Next lngIndex
Else
  MsgBox "You must be in a table to number the table.", vbCritical, "Number Block"
End If
lbl_Exit:
 Exit Sub
Error_subNumberTableColumns:
  MsgBox "An unexpected situation arose in your program." & vbCrLf & _
        "Please write down the following details:" & vbCrLf & vbCrLf & _
        "Module Name: " & "(MODULE_NAME)" & vbCrLf & _
        "Type: VBA Document: " & vbCrLf & _
        "Calling Procedure: " & "(PROCEDURE_NAME}" & vbCrLf & _
        "Error Number: " & Err.Number & vbCrLf & _
        "Error Descritption: " & Err.Description & vbCrLf & vbCrLf & _
        "Resume Exit_" & "(PROCEDURE_NAME)"
  Resume lbl_Exit
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote