Microsoft Office Tutorials and References
In Depth Information
Changing Other Types of Formatting
If there is a password on the form, then enter that password at the top
of the macro module, such as:
Const password as String = "password")ΒΆ
Changing Other Types of Formatting
As mentioned, this tool can be expanded to include other types of formatting,
such as Small Caps or a particular color. For each new addition, follow these
steps:
1. Create a format-specific macro following the pattern for the three
macros presented above, where a representative term for the desired
formatting is substituted, such as for "Underline" in the code
ApplyFormat rng, "Underline".
2. Then, in the procedure 'ApplyFormat' create a new "Case" block that
references the term, such as Case "Underline".
3. Finally, apply the required formatting to the range (rng) as in
rng.Underline = wdUnderlineSingle. For example, in order to apply the
color red to the range, the line of code would be rng.Font.Color =
wdColorRed.
Wrd
If you are unsure of the code you need in order to apply a particular format, use
the macro recorder to record your steps while applying the formatting. The
macro recorder provides, for example, Selection.Font.Bold. Copy the code to the
Case block, then change Selection to rng.
Note: This tool does not work satisfactorily with form fields placed in table cells.
Word does not allow the user to properly select text when a form field is in a
table, so formatting could be applied only to the entire cell, or to the contents
from the selection point to the beginning or end of the cell.
 
Search JabSto ::




Custom Search