Solved

Protection Type for Word template

Posted on 2008-10-08
2
328 Views
Last Modified: 2012-06-27
I am using word 2003.
In my word document template file CustomerRequest.dot I have 15- 20 bookmark fields  form fields.
To fill in these fields I put on template several command buttons that I use to open several UserForms.
Those UserForms I am using for gathering and validation data from a customer.
When a user opens my template it is protected. I am using Tools  Protect Document options to protect document it means no any changes on document form fields -bookmarks just through user forms.
When a user enters data  in a UserForm I do validation and save values from text boxes on the UserForm to template form fields  bookmarks.
I dont allow users to change data in template form fields just to read it. Only time when template is unprotected is time when data are saved- moved from User form to template bookmarks-form fields.
On the UserForm (frmCustomerInfo) I have save button  in Click event I have this code.

    Dim strCompliantDate As String    
    Dim strCustomerName As String    
    Dim strReferenceNum As String


If Me.txtCompliantDate = "" Then
        MsgBox "Please enter compliance date"
        Exit Sub
End If    
   
    If Me.txtCustomerName = "" Then
        MsgBox "Please Enter Customer Name"
        Exit Sub
  End if      
                           
   strCompliantDate = Me.txtCompliantDate
   strCustomerName = Me.txtCustomerName    
   strReferenceNum = Me.txtReferenceNum
   



  ActiveDocument.Unprotect
'pToggleProtectDoc
   ActiveDocument.FormFields("fldCompliantDate").Result = strCompliantDate
   ActiveDocument.FormFields("fldCustomerName").Result = strCustomerName
   ActiveDocument.FormFields("fldReferenceNum").Result = strReferenceNum
       
'pToggleProtectDoc

ActiveDocument.Protect wdAllowOnlyReading
frmCustomerInfo.Hide
Unload Me

Problem is that in word 2003 this is ok but in word 2002 I dont have Protect Type option  wdAllowOnlyReading- .
 I got VB error variable not defined on the line:
>>ActiveDocument.Protect wdAllowOnlyReading<<

In word 2002 I have those protect type : wdAllowOnlyComment, wdAllowOnlyFormField, wdAllowOnlyRevisions, WdNoProtection.
I assume that word 2000 and 97 are the same. What to do to have this template work in all word versions?
I dont want to have wdAllowOnlyFormField  as I dont want user to change data in my template bookmark fields I want to force them to go through UserForm  edit, validation and save procedure.

Any Idea.
Thanks.
0
Comment
Question by:Taras
2 Comments
 
LVL 23

Accepted Solution

by:
irudyk earned 500 total points
ID: 22675945
Try the following:
1. For all form fields, ensure that the Fill-in enabled option is unchecked
2. Protect the document using the wdAllowOnlyFormField option
Doing 1 will prevent users from selecting and entering information into the form fields (i.e. forcing them to use your buttons/input forms)
Doing 2 will protect the document against modifications and will be compatible across all versions of Word.
0
 

Author Closing Comment

by:Taras
ID: 31504224
Thanks irydyk.
That is what I was looking for.
0

Featured Post

A Knowledge Base That Stays Up-to-Date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now