?
Solved

Protection Type for Word template

Posted on 2008-10-08
2
Medium Priority
?
355 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
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 shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
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 …
Suggested Courses

770 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