View Single Post
 
Old 09-10-2019, 12:27 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
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 lngIndex As Long
Dim oRng As Range
  For lngIndex = ActiveDocument.Tables.Count To 2 Step -1
    Set oRng = ActiveDocument.Tables(lngIndex).Range
    oRng.Collapse wdCollapseStart
    oRng.Move wdParagraph, -1
    'By your description, the range should now be defined at the table title.
    If Not oRng.Paragraphs(1).SpaceBefore = 0 Then oRng.Paragraphs(1).SpaceBefore = 0
    If Len(oRng.Paragraphs(1).Previous.Range) = 1 And Not _
       oRng.Paragraphs(1).Previous.Range.Information(wdWithInTable) Then
      oRng.Paragraphs(1).Previous.Range.Delete
    End If
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote