|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to loop through content controls; if has text and has track changes, then accept
I need to create a macro that will loop through all stories; in each story, I need to loop through all of the content controls with text. If the control contains a tracked change, then accept the change.
But I'm stuck at this point: Code:
Sub ContentControlRevisions_Accept() Dim objCC As ContentControl Dim rngStoryRange As Range For Each rngStoryRange In ActiveDocument.StoryRanges For Each objCC In Rng.ContentControls 'If the content control type is text ' If the content control contains track changes Then ' ...accept the track changes in the content control End If End If Next objCC Next rngStoryRange End Sub Thanks |
#2
|
||||
|
||||
Don't overthink it if you are going to accept them all anyway. Accepting revisions when there are no revisions is faster than testing to see if there are revisions before accepting.
Code:
Sub AcceptCCTracks() Dim aCC As ContentControl, aRng As Range For Each aRng In ActiveDocument.StoryRanges For Each aCC In aRng.ContentControls aCC.Range.Revisions.AcceptAll Next aCC Next aRng End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Thank you so much, Andrew -- I appreciate it!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Loop through controls, make certain controls invisible | MacroWizard | Word VBA | 2 | 11-10-2015 02:36 PM |
Loop and Update Content Controls with value | vss712 | Word VBA | 7 | 08-27-2015 08:56 PM |
Rich text/Plain text Content Controls in Template | michael.fisher5 | Word | 9 | 11-19-2014 06:36 AM |
Moving between Rich text content controls | Sammie0Sue | Word | 4 | 03-12-2014 01:43 AM |
Rich Text Content Controls: Formatting? | tinfanide | Word VBA | 8 | 03-04-2013 04:15 AM |