Thread: [Solved] Move to next content control
View Single Post
 
Old 03-01-2011, 02:07 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Brock,

I'm still not understanding exactly what you're trying to do, but maybe the following will help. It puts a tab, then 'i', into the body of the document immediately after the content control it relates to:
Code:
Sub Test()
Dim strTmp As String, i As Integer, Rng As Range
With ActiveDocument.SelectContentControlsByTag("ContainerContents")
  For i = 1 To .Count
    strTmp = strTmp & .Item(i).Range.Text
    Set Rng = .Item(i).Range
    With Rng
      .Collapse (wdCollapseEnd)
      .Move wdCharacter, 1
      .InsertAfter vbTab & i
    End With
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote