Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Protection Type for Word template

Posted on 2008-10-08
2
341 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
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:
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

856 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