Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2018, 09:32 AM
helenndp helenndp is offline Auto populate text box based on drop-down content control and repeat the process via copy paste Windows 10 Auto populate text box based on drop-down content control and repeat the process via copy paste Office 2013
Novice
Auto populate text box based on drop-down content control and repeat the process via copy paste
 
Join Date: Sep 2018
Posts: 2
helenndp is on a distinguished road
Default Auto populate text box based on drop-down content control and repeat the process via copy paste

Hi

I am trying to create one template for reporting. I want to create a word document where I can have several comments. What I would like to do is, create an drop-down content control and based on the choice I want to populate one text box. I can do it for one set of operation.



I would now like to copy paste the set (drop-down + text box) elsewhere in the document and want to have the same functionality available. This process I want to do multiple times. Can you please help me out. I have attached the part I was able to do.
1st set it is working based on the VBA code behind. 2nd set I have just copy pasted. Obviously it is not working. But how do I make it work?

The part of the code that I have manged is available in the forum though.

Thanks in advance
Attached Files
File Type: docm Template.docm (25.6 KB, 23 views)
Reply With Quote
  #2  
Old 09-27-2018, 10:13 AM
gmaxey gmaxey is offline Auto populate text box based on drop-down content control and repeat the process via copy paste Windows 7 32bit Auto populate text box based on drop-down content control and repeat the process via copy paste Office 2016
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,205
gmaxey has a spectacular aura aboutgmaxey has a spectacular aura aboutgmaxey has a spectacular aura about
Default

Well it just doesn't work that way. There is nothing that associates a pair of copied CCs.

If you are pasting them to rows as show in your example then perhaps you could use:

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "Action" Then
  For i = 1 To .DropdownListEntries.Count
    If .DropdownListEntries(i).Text = .Range.Text Then
      StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
      Exit For
    End If
  Next
  ContentControl.Range.Cells(1).Next.Range.ContentControls(1).Range.Text = StrDetails
  End If
End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 09-27-2018, 11:04 AM
helenndp helenndp is offline Auto populate text box based on drop-down content control and repeat the process via copy paste Windows 10 Auto populate text box based on drop-down content control and repeat the process via copy paste Office 2013
Novice
Auto populate text box based on drop-down content control and repeat the process via copy paste
 
Join Date: Sep 2018
Posts: 2
helenndp is on a distinguished road
Default

Well, I don't know how to thank you. This is exactly what I wanted. Thank you very much. It is working great.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to provide text string with specific formating based on Drop down list (content control) MP1989 Word VBA 4 07-30-2018 02:40 AM
Auto populate text box based on drop-down content control and repeat the process via copy paste Content Controls (Drop Down copy and paste), and XML mapping dezdelaina Word 3 03-05-2018 06:50 PM
Auto populate text box based on drop-down content control and repeat the process via copy paste auto populate multiple text boxes dependent on a drop down angelaschultz Word VBA 7 03-18-2017 03:00 PM
Auto populate text box based on drop-down content control and repeat the process via copy paste Auto Populate Text On Dependent Drop Down Exit GregStewartPTC Word VBA 2 02-27-2017 05:37 AM
Populate Drop-Down Content Control from CustomXMLPart added to the Document KhmerBoi1 Word VBA 0 05-11-2016 01:10 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 12:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft