View Single Post
 
Old 02-22-2018, 08:33 PM
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

Try:
Code:
Sub DeleteOneRow()
Application.ScreenUpdating = False
Dim lProt As Long, CCtrl As ContentControl: Const StrPwd As String = ""
'Ensure we're within the row 3 or higher in the 2nd table
With Selection
  If .Information(wdWithInTable) = False Then Exit Sub
  If ActiveDocument.Range(0, .Range.End).Tables.Count <> 2 Then Exit Sub
  If .Cells(1).RowIndex < 3 Then Exit Sub
End With
'Delete the selected row
With ActiveDocument
  lProt = .ProtectionType
  If lProt <> wdNoProtection Then .Unprotect Password:=StrPwd
  With .Tables(2).Rows(Selection.Cells(1).RowIndex)
    For Each CCtrl In .Range.ContentControls
      CCtrl.LockContentControl = False
    Next
    .Delete
  End With
  If lProt <> wdNoProtection Then .Protect Type:=lProt, Password:=StrPwd 
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote