Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2011, 02:07 PM
macropod's Avatar
macropod macropod is online now Move to next content control Windows 7 32bit Move to next content control 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
  #2  
Old 03-02-2011, 09:53 AM
cksm4 cksm4 is offline Move to next content control Windows XP Move to next content control Office 2007
Advanced Beginner
Move to next content control
 
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
  #3  
Old 07-02-2019, 07:48 PM
dpaton05 dpaton05 is offline Move to next content control Windows 10 Move to next content control Office 2016
Novice
 
Join Date: Jul 2019
Posts: 19
dpaton05 is on a distinguished road
Default

Hi Paul,


I just found this thread and it looked similar to what I am looking for but am struggling to find an answer. Can you comment on this thread please?


https://www.msofficeforums.com/word-...rols-form.html


Thanks Paul,
Dave
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Table of Content Eat up RAM Resources Tommy Word 0 08-23-2010 10:08 PM
need to grab content of certain fields? erik2000 Word 0 02-19-2010 04:19 AM
Package for CD with links to Windows media player content and Flash Shockwave content hectorh PowerPoint 4 10-15-2009 12:22 PM
Move to next content control share content between documents? albytrott Word 1 10-08-2009 08:27 AM
Templates: automatic text generation from Rich Text content control Chickenmunga Word 0 10-01-2008 11:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:18 PM.


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