Solved

Protection Type for Word template

Posted on 2008-10-08
2
347 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
[X]
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
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

717 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