
Press ALT+F11 to open the Visual Basic Editor (VB Editor or just VBE). I used one uncommon but very handy DateAndTimePicker control for entering the birthday.
#Microsoft word options to fill in form code
The standard code module contains the code for initiating the Userform and processing Userform contents and other functions.Note: While not demonstrated here, Content Controls introduced with Word 2007 are excellent place marker/data stores in document templates.Īfter you create your template and enter the DocVariable fields and bookmark it is time to open the Visual Basic Editor (VBE) to create a standard code module and Userform object. Enter the bookmark using the Insert Tab>Link>Bookmark ribbon sequence (Word 2007/2010) or the Insert>Bookmarks menu sequence (Word 2003).As an alternative, or you can create DocVariable fields manually by typing then selecting the field code text and pressing CTRL+F9 (e.g.DocVariable fields can be inserted using the Insert Tab>QuickParts>Field>DocVariable ribbon sequence (Word 2007/2010) or Insert>Field>DocVariable menu sequence (Word 2003).For more on Repeating data and populating fields see my: Repeating DataĮnter the boiler plate text (e.g., form labels, headings, etc.) and the DocVariable fields and/or bookmarks as required.When using bookmarks, you can repeat the bookmarked data at other places in your document using REF fields.I want to illustrate a method for putting data "in" a bookmark instead of "at" a bookmark as was shown in the MVP FAQ article.The exception is that I will use a bookmark for the "Address" information. The data in that field will be formatted to match the "D" in "DocVariable. Note the DocVariable field located in the template header.This lets you add different formatting to the text at each DocVariable field. You can take advantage of using the \*CharFormat in the DocVariable fields.Document variables and DocVariable fields are easier to code.On Doug's suggestion, with one exception, I am departing from an often used practice of using bookmarks as place marker\data stores in the document and will use document variables and DocVariables fields instead. As the template contains a VBA project you must use a macro enabled (.dotm extension) template with Word 2007/2010.

Note: If you are using Word 2003 you will use a.
#Microsoft word options to fill in form how to
If you don't know what a template is or if you need help creating one see Word MVP Suzanne Barnhill's: How to Create a Template The template when a opened in Word 2010 with field codes displayed is shown in the illustration below.

