Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Winword doc from template - use the template for multiple pages

Posted on 2016-11-10
3
Medium Priority
?
66 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

715 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