View Single Post
 
Old 02-26-2015, 08:11 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

The quick and dirty way would be to use error handling. Here is another way:

Code:
Private Sub Document_ContentControlBeforeDelete(ByVal OldContentControl As ContentControl, ByVal InUndoRedo As Boolean)
Dim lngIndex As Long
Dim oCC As ContentControl
Dim ContentCtrl As ContentControl
Dim Counter As Long
  Counter = 1
  For lngIndex = ActiveDocument.ContentControls.Count To 1 Step -1
    Set oCC = ActiveDocument.ContentControls(lngIndex)
    If Not oCC.ID = OldContentControl.ID Then
    With oCC
      .LockContents = False
      .Range.Text = Counter
      .LockContents = True
      Counter = Counter + 1
    End With
    End If
  Next lngIndex
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote