Confirmation of correct code
Hi Guessed, apology for querying again, could you please confirm I have the correct code below. I have put together a little test doc to test how it works. I created a content control dropdown, named it "EmploymentType". I created three options for the dropdown "Full time", "Part time" and "Casual". I then created plain text content control paras titling a couple "Full time" "Part time" "casual". I then copied your code to "this document" in VB. I also saved the document as a docm. Have I renamed the code correctly Guessed. I appreciate your assistance, apology I am new to this.
Private Sub Document_ContentControlOnExit(ByVal myCC As ContentControl, Cancel As Boolean)
Dim aCC As ContentControl, sET As String
If myCC.Title = "Full Time" Then
sET = myCC.Range.Text
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Font.Hidden = myCC.Title <> sET 'hide if CC title doesn't match selected employment type
Next aCC
End If
If myCC.Title = "Part Time" Then
sET = myCC.Range.Text
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Font.Hidden = myCC.Title <> sET 'hide if CC title doesn't match selected employment type
Next aCC
End If
If myCC.Title = "Casual" Then
sET = myCC.Range.Text
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Font.Hidden = myCC.Title <> sET 'hide if CC title doesn't match selected employment type
Next aCC
End If
End Sub
|