Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically Insert Templates from Another Template 1

Status
Not open for further replies.

Rooski

Technical User
Sep 28, 2004
44
US
I work for a law enforcement organization that has a large inventory of Word templates which are used for filling out reports in the field. Each template is specific to a particular activity (Field Incident, DUI, Request for Lab Analysis, etc.). Most templates are made up of several sections (suspect info, victim info, witness info, etc.). For example, if an officer encounters a situation involving five witnesses, he must open and fill out three separate Field Incident templates since the witness section of the template has room for only two witnesses. He must then individually save each of these as a separate part of the larger incident report. The final report is then comprised of several individual templates which are then printed off separately.

Does a method exist that allows the dynamic calling of one Word template from another Word template (or sections of templates) which then embeds the called templates or sections into the calling template? The idea is two-fold:

1) To allow officers to call different templates as the situation dictates
2) Allow the consolidation of the separate templates into one template.

I have searched every TekTip forum I can think of remotely related to this concept, but could not find an answer.

Thanks,

Rooski
 
Hi Rooski,

Everything you want can certainly be done but can you give a bit more detail?

1. You talk about templates and I'm not sure whether you mean Word templates (.dot files) or Word documents (.doc files).

2. How are the templates/documents set up for data entry - do they use Word Forms with fill-in fields/dropdowns, etc. - and if so, are the bookmark names of those fields referenced anywhere (either in other fields or VBA code)?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Tony,

Thank you for your response.

I met with the person who developed all the templates in order to provide more detail and answers to your questions.

First, these are Word templates (.dot files).

Secondly, regarding data entry, these templates use Word Forms with fill-in fields and some dropdowns. Some of the bookmark names of these fields are referenced in other fields. The person who developed these templates has no coding experience whatsoever (which is why she asked me to provide some help). Consequently, the templates have no macros or VBA code in them.

I am not a very experienced Word user whereas the person who developed the templates is but, as I said, she completely lacks coding skills. I, on the other hand, have a development background (mostly COBOL) with some VBA (beginner to intermediate in Access). I, however, have never used VBA in Word. Between us, we are expected to determine the feasibility of fulfilling this request to dynamically call templates from templates. This request is not the most timely as the entire inventory of reporting templates is scheduled to be replaced with a commercially available automated reporting application in about a year. Consequently, I would also appreciate your opinion on whether the effort to satisfy the request will produce enough of a benefit considering the limited time it will be used.

Other details;
a) There are approximately 250 different templates.
b) The templates are protected but contain both protected and unprotected sections.

Any advice you can give would be greatly appreciated.

Thanks in advance,

Rooski
 
Hi Rooski,

I'd suggest taking an even more modular approach:

As I understand it, your "Field Incident Report", for example, might have anything from 0 to n Witness Statements. In that case, you could have a basic "Field Incident Report" template, with no Witness Statements, and a separate "Witness Statement" template.

Your "Field Incident Report" template would then consist of the generic material only, with the required formfields etc in a protected Section, followed by a 'continuous' section break that sets up an unprotected section into which any completed Witness Statements could be inserted.

Your "Witness Statement" template, which would be for a single Witness Statement only (you'd use a new document for each witness) might also have formfields etc in a protected Section, followed by a section break that sets up an unprotected section into which any free-form information might be typed.

Your "Field Incident Report" template (and preferebaly your "Witness Statement" template), would have a style that corresponds to the first paragraph in the "Witness Statement" template formatted with the 'Page Break Before' attribute. This will cause each inserted Witness Statement to start on a new page.

To insert the Witness Statements into a "Field Incident Report", you'd simply use File|Insert for each one in turn, for as many as you need.

Done correctly (though this bit's tricky), you could even have the Witness Statements listed in the Field Incident Report's TOC (if you have one - this could even be mid-way through the report and be no more than a schedule of Witness Statements).

As for your question about cost/benefit for something that's due to be replaced with an entirely different product, that's something you'll have to work out locally. Not only will you have the development cost to think about, but you'll also have the deployment and training costs to consider. On the plus side, it might be easier to import the data from the proposed structure into your new system.

Cheers
PS: No vba is needed for any of the above!
 
Macropod,

Thank you for your response. This is exactly the type of gateway the developer of the templates and I were looking for. We have conducted some experiments based on your suggestions and managed to get things working as you describe. We greatly appreciate the time you took to post these suggestions.

Thanks,

Rooski
 
Macropod (or anyone else),

If you are still following this thread, I have an extended question based on the results of the experimentation my co-worker and I did yesterday.

As I said in my previous post, we were able to insert a Witness Statement template into the Field Incident Report and follow it with as many other Witness Statement templates as we desired. The Witness Statement template, like all templates in the template inventory, are protected so officers can tab to entry-eligible fields only. After we insert a Witness Statement template (or any other template) into an unprotected continuous section break of the Field Incident Report, the Witness template, even though it was protected before insertion, is unprotected after insertion. This seems to make sense given that it is being inserted into an unprotected section. Unfortunately, the template must be protected after it is inserted and it must achieve this status without officer intervention since the protection feature is password protected. Additionally, we need to have the unprotected insertion point maintained so officers can insert additional templates as needed.

If it takes VBA code to do this, I believe I can implement it based on my experience with Access VB. I would just need to know if it is even possible, and then a small hint to get me started.

Thanks,

Rooski


 
Hi Rooski,

When you insert the witness statement, all that gets inserted is a copy of the original - the original remains protected. If you insert the witness statement as a link, which you could implement through vba, then it becomes easire to keep the 'copy' in sync with the original. One way of doing this would be to set up one of the formfields so that the user nominates the number of completed witness statements, which then triggers a macro that loops though an insert-link process.

With a bit more vba coding, you could have each inserted witness statement incorporated into the protected section. This may require temporarily unprotecting the document, but you can do that with vba without the user ever knowing what the password is.

Cheers
 
Macropod,

Thank you for the reply. I will do some research based on your suggestions and experiment with VBA once my co-worker returns from leave.

Thanks again,

Rooski
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top