Thread: [Solved] Move to next content control
View Single Post
 
Old 01-31-2011, 12:19 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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,

The 'Exit For' was there because your post implied that you only wanted the very next Content Control, not all of them, and you didn't indicate anything about whether the next Content Control had the same tag.

Since it seems only some of the Content Controls have the 'ContainerContents' tag, it would be more efficient to do it this way:
Code:
Dim strTmp As String, i As Integer
With ActiveDocument.SelectContentControlsByTag("ContainerContents")
  For i = 1 To .Count
    strTmp = strTmp & .Item(i).Range.Text
  Next
End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote