Article ID: 191028 - Last Review: January 23, 2007 - Revision: 4.4 How to retain information typed into a form field when you protect a formThis article was previously published under Q191028 On This PageSUMMARY
This article describes methods that allow you to do the following:
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For additional information about how to use the sample code in this article, click the following article numbers to view the articles in the Microsoft Knowledge Base: 290140
(http://support.microsoft.com/kb/290140/
)
How to run the sample code for the Office XP programs from Knowledge Base articles
212536
(http://support.microsoft.com/kb/212536/
)
How to run sample code from Knowledge Base articles in Office 2000
Method 1: Alter the Protect/Unprotect Command FunctionalityThe following Microsoft Visual Basic for Applications macros (Sub procedures) protect your form without causing you to lose the text that you entered into a form field. The macros can be stored in the actual form template to allow you to manually unprotect and reprotect the form while preserving the form field contents.The following three macros can be used to ensure that your form field values are not reset to their defaults when you reprotect the form.
Note The name of this macro must be ToolsProtectUnprotectDocument. Method 2: Create a Macro to Protect/Unprotect Your DocumentThe following examples protect the active document for forms without resetting the contents of the form fields. Create the macro and assign the macro to a key, menu, or toolbar button for easy access.Method 3: Unprotect, Check Spelling or Update a Field, Reprotect a DocumentBecause form field text is formatted for No Proofing, you can use the following macro to:
Compile error: Method or data member not found 181108
(http://support.microsoft.com/kb/181108/
)
WD97: Form fields lose text when protected for forms
REFERENCES
For additional information about getting help with Visual Basic for Applications, click the following article numbers to view the articles in the Microsoft Knowledge Base:
212623
(http://support.microsoft.com/kb/212623/
)
WD2000: Macro programming resources
305326
(http://support.microsoft.com/kb/305326/
)
List of programming resources for Visual Basic for Applications
226118
(http://support.microsoft.com/kb/226118/
)
List of resources that are available to help you learn Visual Basic for Applications programming
| Article Translations
|
Back to the top
