Thread: [Solved] Move to next content control
View Single Post
 
Old 03-02-2011, 09:53 AM
cksm4 cksm4 is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Aug 2010
Posts: 48
cksm4 is on a distinguished road
Default

Hey Paul,

Yes, that helped a lot. This is the first time I used a range in this manner and I needed your example to put me in the right direction. Here is the code that does what I need:

Code:
With ActiveDocument
    For i = 1 To .ContentControls.Count
        If .ContentControls(i).Tag = "ContainerContents" Then
            strTmp = .ContentControls(i).Range.Text & .ContentControls(i + 1).Range.Text
            Set Rng = .ContentControls(i + 1).Range
            With Rng
                .Collapse (wdCollapseEnd)
                .Move wdCharacter, 1
                .InsertAfter strTmp
            End With
        strTmp = ""
        End If
    Next
End With
Thanks again!!
Reply With Quote