How do I get Excel to export data to Word templates and save individual documents as both word and PDF document

DarC69 used Ask the Experts™
I currently have an excel spreadsheet which contains data that is entered via a form designed using excel VBA. This form allows a user to enter data once but populate 2 different worksheets which are formatted in different ways in order to facilitate the production of 2 different word documents.
I currently have the code working within Excel to handle the data entry into the spreadsheet and data is being populated as required.
What I need to do is push this information from the individual worksheets to a corresponding word template and save individual copies of the produced documents to the local hard drive as both a word document and a PDF file.
I have a tried a few ways to do this but I am running into a number of issues which have caused me to add/edit and delete code over the last few days and I'm still getting nowhere.
Any help or direction that someone can give me in order to get the automation process working would be very much appreciated.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

In MS Word you have the ability to add content controls which you can then map to each item of information from the spreadsheet (assuming that is possible).  What approaches have you tried?
The content controls, if you have not used them before, are cool because you can give them a tag and a title and you can select them by tag / title....

so you could have a set of controls with a tag called A then use VBA to select the set, something like:
Dim oCCs as ContentControls
Dim oCC as ContentControl
set oCCs = activedocument.contentcontrols.selectbytag("A")

for each oCC in oCCs ....

' and then write the value appropriate to that control...

Open in new window

[ Edit: actually I think the proper syntax is Set oCCs = ActiveDocument.SelectContentControlsByTag("A") ]


I initially considered just using mail merge but this didn't really deliver what I needed. However these documents were the initial starting point for the templates as they pick up the data correctly.

I have tried to use bookmarks unsuccessfully although I'm sure they could probably work.  

With regard to Content Controls I am not familiar with them so I can give them a try and see how I get on thanks for the suggestion.

Content controls are much more stable than bookmarks and you can also specify styles and more. Enable the developer tab in word. Also Google for Greg Maxey. He has some good articles on them. Good luck
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial