Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to know if possible (dealing with MS Word Form fields)

Status
Not open for further replies.

Netooi

Programmer
May 15, 2002
29
US
Ok, I have a MS Word Document that uses form fields.. Of course when the fields are active, the document is protected so you can only access the form fields... Is it possible to be able to access different sections of the document that arent part of the form fields...
Here is my situation:

I have a checkbox form field.. Based on whether it is checked or not, later on in the document I want certain questions to be visible or not visible. My problem right now is that i cant access that text because it is protected.

Here is illustration::
Yes No
Check __ __

--- a few pages later we come to the questions ---

1. If checked yes, this question is visible, otherwise it isnt.
2. If Checked yes, this question is also visible, otherwise it isnt.


So a two part question.. The main thing i need to know is whether it is possible or not to access the questions while the form is protected.. If anyone has some suggestions about how to go about making the questions visible or not that would be very helpful also.

Thanks,
Netooi
 
I am doing something similar at the moment.

Try this: Create a bit of code that you then carry out when the check box is left (although I cant do that here, Word 97 crashes completely) or when the user has finished doing all the check box bits and clicks onto a button.

Unprotect the document, jump to the bookmark you set up for the questions and insert bits of AutoText depending on whether the result (magic word) of the given check box is 1 or 0.

After you have inserted all the bits of AutoText reprotect the document, not forgetting to say noreset:=true. That way what the user has put into the form fields doesn't get chucked out.

Here are bits of code, not all of it.

Code:
' Reading out the result of a check box:
If ActiveDocument.FormFields("Name_of_checkbox").Result = "0" Then
    MsgBox "It is not checked"
Else
    MsgBox "It is checked"
End If

' Protection without resetting the contents of the form fields:
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Good luck :)

Carol
Berlin, Germany
 
By the way, I got this information in this forum. Thanx guys :)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top