|
|
|
This Microsoft Word Help and Tips Page provides a VBA method to globally name/rename and sequence formfields in a document. Whenever you create a new formfield Word automatically assigns a default bookmark designation to the formfield. The default designation is alphanumeric and determined by the type of formfield and the number of pre-existing formfields of the same type in the document. For example, if you open and new blank document and insert a textinput formfield, a checkbox formfield, and a dropdown formfield, the document will contain three bookmarks:
If you then insert a second textinput formfield after the first textinput formfield, Word will automatically designated this new formfield as Text2. Similar results occur if you insert additional checkboxes or dropdowns after existing formfields in the document. A problem arises when you insert new formfields before or in between existing formfields. While Word gets the “alpha” portion of the designation correct, the numeric part is strictly sequential and therefore appears to get out of whack. For example, if you insert a third textinput formfield between the two previously mentioned it will be designated text3 (i.e., Word does not re-sequence the existing form fields so that the fields appear sequential in the document). A second problem occurs when you copy and paste existing formfields in a document. Regardless of where formfields are pasted these “cloned” fields have no bookmark designation at all.
If you have ever created a form contains lots of formfields, then you know that nothing is faster than copying and pasting the formfields. You will also know that it is then a slow and laborious process to manually select and bookmark each one. The following macro will do this task for you automatically and as it cycles through each formfield in a document it will automatically reassign the proper default bookmark designation
After running the macro, all existing formfields are named and indexed with default designations.
Need help applying macros? See fellow MVP Graham Mayor's Guide for Installing Macros Looking for something else?
|