"The requested member of the collection doesn't exist".
Resuming puts the cursor on the line "Selection.Tables(1).Select" at the top of the code.
Code: Select all
Sub ReFormatTable()
Dim c As Cell
On Error GoTo Err_ReFormatTable
Application.ScreenUpdating = False
Selection.Tables(1).Select
If Selection.Information(wdWithInTable) <> True Then
MsgBox "The cursor is not in a table", vbOKOnly
GoTo Exit_ReFormatTable
End If
Selection.Font.Name = "Calibri"
Selection.Font.Size = 11
With Selection.ParagraphFormat
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.LineUnitBefore = 0
.LineUnitAfter = 0
End With
Selection.Rows.HeightRule = wdRowHeightExactly
Selection.Rows.Height = CentimetersToPoints(0.5)
Selection.Tables(1).Select
For Each c In Selection.Cells
With c
Cntr = Cntr + 1
If Cntr = 1 Then
.VerticalAlignment = wdAlignVerticalTop
End If
.TopPadding = CentimetersToPoints(0.05)
.BottomPadding = CentimetersToPoints(0.05)
.LeftPadding = CentimetersToPoints(0.05)
.RightPadding = CentimetersToPoints(0.05)
.WordWrap = True
.FitText = False
End With
Next c
With Selection.Tables(1).Rows(1)
.Alignment = wdAlignRowLeft
.Height = CentimetersToPoints(0.7)
.Cells.VerticalAlignment = wdCellAlignVerticalBottom
End With 'Selection.Tables(1).Rows(1)
Exit_ReFormatTable:
Application.ScreenUpdating = True
Exit Sub
Err_ReFormatTable:
MsgBox Err.Description
GoTo Exit_ReFormatTable
Resume
End Sub