Monday, May 18, 2015

How to create a template in MS Word



This video shows how to create a template in MS Word. Templates are useful for automating word documents. When you have to create multiple documents with the same content but with few new items, this template will come handy. For example, if you want to create sub-contract documents, with different clients, only the client-specific detail will change and the document format will remain same. In this, you have to change only the client information, other things like contract rules, will remain same. In the template fill the client-specific information the generate the new document for the new client by just pressing a button. You can store repetitive values somewhere in the bookmark and place them wherever needed. The macro or the VBA code is very simple and it can be extended to add other functionalities.

There are 3 steps to create MS word templates.
Step 1
Create a section of bookmarks, which hold the value you enter. These are hidden.

Step 2
Create field code to populate the values. Use ASK filed to get the values from user and store them in the bookmarks created earlier.

Step 3
Create fields where you want to place the values stored in bookmarks. use the FORMULA field to get the value from bookmark and place them wherever you want
code REF Bookmark name
Finally, you can create a macro to update all the values. For this, you can create a button and assign the code to it.

VBA code
-------------------------------------
Private Sub Update_Click()
Fields.Update
End Sub
-------------------------------------

VBA Code to find a record in the MS word mail merge

MS Word mail merge has an option to navigate through the records. The below VBA code will help you to type and search the record within the ...