Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-26-2015, 08:11 AM
gmaxey gmaxey is offline Document_ContentControlBeforeDelete Event Windows 7 32bit Document_ContentControlBeforeDelete Event Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,635
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
 

Tags
content control, content control events, events



Similar Threads
Thread Thread Starter Forum Replies Last Post
File beforeSave Event Megazoid Word VBA 3 09-14-2014 01:41 AM
Hyperlinks in Calendar Event? komobu Outlook 0 07-16-2014 08:09 AM
Workbook_Open event do not working? beginner Excel Programming 8 04-11-2013 02:37 PM
Duplicate event reminders rgarneau Outlook 0 01-23-2012 08:58 AM
Event Log - Outlook Crashed Davva Outlook 0 11-10-2009 01:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft