Solved

Winword doc from template - use the template for multiple pages

Posted on 2016-11-10
3
20 Views
Last Modified: 2016-11-14
I've got a winword document I create from a template and fill in details via automation from an access database using VBA and bookmarks in the word doc.  The automation code exists and works.  
Now I would like to create a second (or further) page based on the template with some of the information/bookmarks being duplicated.  This new function might be required once a year or less often so a complete rewrite isn't going to happen.

eg. At the top of each page I would want the customer name, address and an ID to be duplicated.  Remember the information is pushed into the document when it is created in response to a button click.

I can think of creating a new document for page two, filling it in then select all and copy/paste into the first document as a new page.  It should work but is really cludgy.
Is there an easier way to do this?
0
Comment
Question by:AndyAinscow
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 41882777
You probably realise that you can't copy bookmarks directly. All bookmarks in a document must be uniquely named. Your idea of using a separate document would be one way around that problem.

Other solutions might require some redesign of your original system.

You could use REF fields to repeat the data in the bookmarked locations.

You could put the customer information in the document header, so that it is reproduced on all pages, If you only want it in the second and subsequent pages, you could have a different first page and the information in the prime header.

If you don't need to support Word versions older than 2007, you could use content fields. These can be copied, the copies retaining the Tag and Title properties. There are  SelectContentControlsByTag and SelectContentControlsByTitle that give collections that can be walked through.

It might help if you could post a non-confidential example.
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 41882817
Thanks, I wasn't really expecting a simple way but would kick myself if there was and I didn't explore for it.
Interesting idea with the ContentFields.  I'll have a look into that.  It is only 'newer' versions of word involved.
0
 
LVL 44

Author Closing Comment

by:AndyAinscow
ID: 41887381
Thanks.
I'll be going with my original idea of a new doc, copy and paste to page 2....  I think it will be less changes required
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now