?
Solved

Creating a Word Document 'Template' with auto-fill

Posted on 2006-04-13
7
Medium Priority
?
5,576 Views
Last Modified: 2008-02-01
Hello

I need to turn an existing Word document into a quick fill template. For example if my company has a proposal written for another company in MS Word format I want to turn that into a fillable 'template' so that the next time I just have to fill in the company's name, date, project title, etc.etc. and it will automatically auto populate the documents.

It's just like search and replace.

But I want it to have a wizard like interface if possible.

Any suggestions? I would appreciate a sample document too.

Thanks.
0
Comment
Question by:happyguy82
  • 4
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 16443767
The simplest way would be to use form fields and forms protection. That you the user would not be able to edit the 'fixed' text, but have spaces to fill in the variable text.

Show the Forms toolbar.

Replace the variable text with text form fields - 'ab|' button. If you right-click on the inserted field, and choose 'Properties' from the pop-up, you can set the default text and formatting.

There are also checkbox and dropdown fileds that can be used.

To test the form, lock and unlock it using the padlock icon.

After the design is complete, if you protect the document via Tools/Protect document you will be able to set a password for unlocking the document. You can then save the document as a template.

It is possible to write a wizard in VBA, with a series of Userforms to gather data and to load the data onto the document. There are various techniques available to help locate the receiving position on the document - bookmarks, Ref fields and table cells are three. Actually, the easiest is to use form fields.
0
 

Author Comment

by:happyguy82
ID: 16454912
Hi GrahamSkan,

Your answer is quite comprehensive for now and I thank you for it. Allow me a few days to try this out and in the meantime if you could furnish me with a sample document with the locked fields(also give me the password so I can unlock) it would be of great help.

Your proposal to create the wizards in VBA sounds great unfortunately I really don't know how to start this off. Could you please assist me with this?

I would be happy in increase the number of points for this question once I resolve this issue to my company's expectiation.

Thanks so much.

Warm Regards.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16460516
We can't post documents on this forum: we can only try to tell you how to do it as I did in my first comment. If you are having specific difficulty, let us know.

What to tell you about creating a VBA wizard depends on what you know about VBA already. If you are new to VBA, I suggest that you stick to the document form.

Otherwise I would point out that the main advantage of a Wizard is that the data can be validated. Also it can be used to modify the otherwise protected data. It could, for instance, be used to extend tables or to insert optional text.

General advice is to use one VBA userform for each logical group of data. Add some command buttons captioned "<<Back" and "Next>>" and perhaps "Cancel", "Apply" and "Finish". It helps to keep a correlation between the UserForm control names and the field names on the document. Remember that if you want the user to be able to restart the wizard on a partially completed document, you will have to read the document data on to the user form.
0
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 

Author Comment

by:happyguy82
ID: 16460651
Hi GrahamSkan,

Ok I tried your form method but I have a question. Assuming the text field 'User Name' appears 5 times in the document, I want it to be such that once I fill out one of the field it will auto populate the rest. How can this be done w/o using wizard? Is there a way to 'tie' the editable text fields together?

Thanks.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16460807
Form field names are actually bookmarks which, of course, must be unique (and a single word) , so you can't have several actually called 'User Name'.

You can, however, have 'Ref' fields in the places that you want any data to be repeated, but they would not then be editable separately.

While the form is unlocked, you can see (and set) the form field name by right-clicking on the field and choosing 'Properties' from the pop-up. Make a note of the name. It  is in the box labelled 'Bookmark:'. While you are there, also make sure that 'Calculate on exit:' is ticked. That causes the 'Ref', and any other fields to be updated immediately you tab out of the form field.

Select each place for the 'Ref' field and do Insert/Field. Choose Ref and make sure that the formfiled bookmark name is entered.

Protect (lock) the document before testing.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16463377
Note that if you wanted to be able to change the "User Name" texts later to make then different from the first, but still be filled automatically after a change to the first one, they would have to be FormFields and the text copied with a VBA macro that has be set to be the first field's exit macro.

Sub MyExitMacro
      ActiveDocument.FormFields("UserName2").Result = ActiveDocument.FormFields("UserName1").Result
      ActiveDocument.FormFields("UserName3").Result = ActiveDocument.FormFields("UserName1").Result
      ActiveDocument.FormFields("UserName4").Result = ActiveDocument.FormFields("UserName1").Result
End Sub
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
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.
Suggested Courses

850 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