I'm trying to programmatically update the text of some content controls, based on another control. I'm getting the following error:
"Run time error 6124. You are not allowed to edit this selection because it is protected".
Here's my code so far:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Select Case ContentControl.Title
Case "Party"
Call CascadeParty(ContentControl)
End Select
End Sub
Sub CascadeParty(ByVal cControl As ContentControl)
Dim con As ContentControl
For Each con In ActiveDocument.ContentControls
If con.Title = "Party" Then
con.Range.Text = cControl.Range.Text ' ERROR HERE
End If
Next con
End Sub
I've also tried passing a string instead of the control, same problem. None of the answers on this similar post helped. The document is not protected in any way and none of the content controls are locked.
Any ideas? Thanks.
UPDATE: I've tried my code in a fresh clean document and it works fine, so it's something about the document I've been given. Again, nothing is protected so I'm still at a loss.