View Single Post
 
Old 10-30-2014, 06:03 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A different way of approaching this issue would be to bookmark the ranges spanning the tables that correspond to each formfield. Then you could use code like:
Code:
Sub Parent()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
  .Unprotect
  Select Case .FormFields("Parent1").Result
  Case "No"
    With .Bookmarks("BkMk1").Range
      While .Tables.Count > 0
        .Tables(1).Delete
      Wend
    End With
  End Select
  .Protect wdAllowOnlyFormFields, True
End With
Application.ScreenUpdating = True
End Sub
where 'BkMk1' is the bookmark name. That way, it doesn't matter whether tables in any other ranges have been deleted - the code looks only at its own range.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote