Conditional Check boxes

D

dave

Hello,

I am working with a protected form template. What I am trying to do is
to make certain check boxes (from the Forms toolbar not ActiveX
controls) appear when a certain selection is made from a dropdown
menu.

This way, the user cannot select the wrong option.

Would it be a simple If...Then VBA statement?

Any help would be great!

Thanks,

Dave O
 
H

Helmut Weber

Hi Dave,

not simple, IMHO.

You may set the font of the range of a checkbox to hidden.
But for that you have to remove the protection.
Removing the protection resets the values of fields
to their default values.
Therefore it seems, you have to remember the values
(results) of the fields and restore them after
changing the font.hidden property.

Sub MyExit67003()
Dim sTmp As String
Dim bChk As Boolean
With ActiveDocument
sTmp = .FormFields(3).Result
bChk = .FormFields(2).CheckBox.Value
.Unprotect
If sTmp = "a" Then
.FormFields(2).Range.Font.Hidden = True
Else
.FormFields(2).Range.Font.Hidden = False
End If
.Protect wdAllowOnlyFormFields
.FormFields(3).Result = sTmp
.FormFields(2).CheckBox.Value = bChk
MsgBox .FormFields(2).Result ' for testing
End With
End Sub

I don't think I'm an expert on formfields and forms.
If you have a close look, you'll notice,
that I didn't bother about formfields(1).

But if it helps, its alright.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top