![]() |
|
#2
|
||||
|
||||
|
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] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Listbox Content Control - Reset default/prompt?
|
ArtKilp | Word VBA | 7 | 08-08-2017 05:31 PM |
Problems Copy table content and reset contentControls
|
h0mebrewer | Word VBA | 1 | 12-14-2016 05:37 PM |
| Macro to save docx to doc that checks compatibility and converts content controls to static content. | staicumihai | Word VBA | 4 | 10-12-2016 08:23 PM |
| VBA for content controls | ciresuark | Word VBA | 1 | 03-10-2015 03:14 PM |
Content Controls
|
Sammie0Sue | Word | 6 | 11-06-2013 10:56 PM |