We help IT Professionals succeed at work.
Get Started

best way to create Word 2010 documents from Word 2003 templates with merge from SQL

GordonPrince asked
Last Modified: 2012-05-12
I've inherited several hundred Word 2003 templates that are full of field codes. My users now have Word 2010. My data is in SQL-2005. I'm an experienced VBA & SQL programmer.

There are only about 25 fields in the 200 documents, so I'd like to get creating new documents from the templates to work as quickly as possible.

I have experience using Word templates with bookmarks, then running VBA to step through the bookmarks and paste data at each bookmark. But I haven't used merge with Word field codes for many years.

Any guidance from anyone who has done both about how to proceed?

1. Step through the template stopping at field codes and pasting data there (treat the field codes the same as bookmarks).
2. Convert all the templates replacing field codes with bookmarks, then using bookmarks as bookmarks.
3. Use VBA to do a Word merge setting the data source to be SQL with a where clause to only select the one row that should go into the document.

These are only going to be generated one at a time, on demand by users, the documents look to be mostly 1-3 pages long, so I don't think performance is going to be an issue. I would like to be able to reuse the documents in as close to the state they have been given to me as possible (jto get into production as quickly as possible), so I'm wondering if anyone has enough experience to offer guidance on the best way to go at this.

Watch Question
Top Expert 2012
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE