Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 73
  • Last Modified:

Winword doc from template - use the template for multiple pages

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
AndyAinscow
Asked:
AndyAinscow
  • 2
1 Solution
 
GrahamSkanCommented:
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
 
AndyAinscowAuthor Commented:
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
 
AndyAinscowAuthor Commented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now