[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Protection Type for Word template

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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
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 …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

650 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