View Single Post
 
Old 08-27-2019, 06:34 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I thought you wanted to omit (delete tables) and omit (delete table captions). Try this:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim i As Long
Dim wdDoc As Document
  Set wdDoc = ActiveDocument
  For i = 1 To wdDoc.Paragraphs.Count
  If Not wdDoc.Paragraphs(i).Range.Information(wdWithInTable) Then
    If wdDoc.Paragraphs(i).Range.Fields.Count > 0 Then
      If Not fcnEvalForTableCaption(wdDoc.Paragraphs(i).Range) Then
        'Process
      End If
    Else
       'Process
    End If
    
   'process revisions
  End If
Next i

lbl_Exit:
  Exit Sub
  
End Sub

Function fcnEvalForTableCaption(oRng As Range)
Dim oFld As Field
  fcnEvalForTableCaption = False
  For Each oFld In oRng.Fields
    If oFld.Type = 12 Then
      If InStr(oFld.Code, "Table") Then
        fcnEvalForTableCaption = True
        Exit For
      End If
    End If
  Next
End Function
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote