![]() ![]() In this Userform I have included most of the common Userform controls. The Userform for the Student Survey form is shown below: The resulting Userform is presented as a graphical user interface and serves to collect and in certain cases validate student responses to the survey questions.The Userform object is where the Userform is actually designed.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. 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. A Userform to provide a graphical user interface with the students preparing the form.A standard VBA code module initialization and processing code.A bookmark for one specific data element (Address field).DocVariable fields placed at "most" locations where data entered by students in the Userform will be placed.The boilerplate text of the Student Survey.It contains lots of information on userforms in general that you won't want to miss.įor this section I am going to create a demonstration template with a Userform for a "Student Survey" form. ![]() ![]() Note: Even if you are interested in the Content Control Method, be sure to review this section as well. For a method using content controls with Word 2013, 2010 and a limited bases 2007, see Content Control Method. The first section of this tips page provides methods which are universal to all current Word versions (2003, 2007, 20). In this Microsoft Word Tips & Microsoft Word Help page I will show you how to create and employ a document template and Userform. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |