Microsoft Office Tutorials and References
In Depth Information
Forms: Formatting Text Input in Form Fields
Forms: Formatting Text Input in Form Fields
This procedure lets you apply bold, italic, and color formatting to the text
entered in form fields and also demonstrates error handling.
Note: This tool currently provides for bold, italic, and underline formatting. The
adventurous coder can expand it to include other types of formatting, by
following the same pattern.
Example file:
Scenario: Word’s forms functionality is designed to allow
text input only; no formatting is supported and formatting
can only be applied in unprotected sections. Sometimes, this
is exactly what is wanted. However, in some forms, allowing
the user to apply simple formatting, such as bold or italics, is
the desired functionality.
View the Appendix to learn how to store this procedure
in a Standard module.
Option explicit¶
' * * * * *¶
'If the form has more than one table¶
'set this value to the number of the¶
'table to process with this code¶
Const TableIndex As Long = 1¶
'Name of the AutoText entry that contains¶
'the row that should be inserted¶
Const AutoTextName As String = "NewRow"¶
'Enter the number of rows that should remain¶
'below the row being inserted For example,¶
'this sample table has one row,¶
'the Totals row, that should stay at the end¶
'This and the password constant are shared¶
'with the DeleteCurrentRow macro¶
Public Const EndRowsIndex As Long = 1¶
'The password to unprotect (leave as is if¶
'not assigning a password to the form¶
Public Const password = ""¶
Search JabSto ::

Custom Search