Hey Guessed, I have got it working although it is not correct. Everything goes into hidden text. I did change the sSET to what Graham suggested.
I propose if I can get this going to create a macro to delete all hidden text.
Any suggestions as to why everything turns to hidden text? I have checked that the names are all consistent within the VB code and the content controls.
Also which I find a bit strange, even though the content control text is in hidden text (I can tell because of the dotted line underneath the text) - I can see it on the screen even though I have selection in File/Options do not show hidden text (box unticked).
Here is the current code placed in "this document" :
Private Sub Document_ContentControlOnExit(ByVal myCC As ContentControl, Cancel As Boolean)
Dim aCC As ContentControl, strSet As String
If myCC.Title = "Full Time" Then
strSet = myCC.Range.Text
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Font.Hidden = aCC.Title <> strSet 'hide if CC title doesn't match selected employment type
Next aCC
End If
If myCC.Title = "Part Time" Then
strSet = myCC.Range.Text
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Font.Hidden = aCC.Title <> strSet 'hide if CC title doesn't match selected employment type
Next aCC
End If
If myCC.Title = "Casual" Then
strSet = myCC.Range.Text
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Font.Hidden = aCC.Title <> strSet 'hide if CC title doesn't match selected employment type
Next aCC
End If
End Sub
thank you for your assistance, sorry about keep coming back - I think the error is something very simple, but I'm unable to see it.
|