Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 08-31-2020, 05:13 PM
Guessed's Avatar
Guessed Guessed is offline Word form that auto-populates (from Excel sheet) other content controls based on one,manually filled Windows 10 Word form that auto-populates (from Excel sheet) other content controls based on one,manually filled Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Greg's Document_ContentControlOnExit macro is showing how to retrieve an array of data from a single list item in a Content Control. It assumes that each entry in a dropdown CC list contains a displayed name plus a 'value' which contains a series of values separated by a "|" symbol. Then when the user makes a selection with that CC, the macro fires to transfer the other data into other content controls (date, address etc).

There are threads on this forum where this type of functionality was requested. https://www.msofficeforums.com/word-...own-lists.html
I'm not convinced this macro is what you need for your project but it can be useful for other requirements.

The question I have for you is does the number of rows in your data source vary? Your initial sample shows 7 entries and the most recent shows an extra one added. If this project has to adapt to variable numbers of participants it makes the complexity a lot bigger as paragraphs will need to be added/removed accordingly depending on that count.

Charles' suggestion of Mail Merge is a possibility but it appears you want all the rows of data in the one interwoven file so I'm going to recommend you stay with the CC + code approach. I'm thinking you might get mileage from repeating content controls and will need to import the excel data as embedded xml to set this up.

Because you are using code to transfer the data from Excel to CCs in Word, there are essentially two ways to do this:
1. Write the excel data to an embedded xml file and use linked CCs to display that data
2. Write the excel data direct to CCs (which may or may not be linked to embedded xml)

Option 2 is limited to a fixed number of records unless you then include code to expand or reduce the paragraphs for each new record. Option 1 may be more automated to deal with variable record counts if the xml is structured well enough. I will have a play with your provided files to see what I can add.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
word fields, word vba, word vba macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word form that auto-populates (from Excel sheet) other content controls based on one,manually filled Reset "Button" to clear Word user-filled form, from all filled details. Rafi Word VBA 20 01-20-2023 02:16 PM
Word form that auto-populates (from Excel sheet) other content controls based on one,manually filled VBA to Populate text content controls in word from excel lmoir87 Word VBA 15 05-27-2022 04:22 PM
Auto populate form (data from excel) in Word based on drop down list selection (data from excel) wvlls Word VBA 1 03-22-2019 02:29 PM
Form with content controls - expands but at the bottom of the form louiseword Word 3 05-27-2016 12:47 AM
Word form that auto-populates (from Excel sheet) other content controls based on one,manually filled Date auto-populates based on checkbox mcarter9000 Word VBA 5 12-23-2010 12:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:52 AM.


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