Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3189
  • Last Modified:

Runtime error 6124 : You are not allowed to edit this selection because it is protected

I am gettibng this error at the last line of this snippet.

I am not aware of what is protected. Can anyone help?

Dim objTemplate As Template
    Dim objBB As BuildingBlock
    Dim bbRange As Range
    ' Set the template to store the building block
    Set objTemplate = GetTemplate
    Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustom2) _
    Set bbRange = objBB.Insert(Selection.Range)

    Dim cc As ContentControl
    Set cc = bbRange.ContentControls.Item(4)
    If cc.Type = wdContentControlPicture Then
        If cc.Range.InlineShapes.Count > 0 Then
            cc.Range.Text = ThisDocument.strSourceComments

Open in new window

Philip Pinnell
Philip Pinnell
  • 2
1 Solution
The general model of a content control includes a Text property. This is a picture type of control, so it doesn't make sense to write to its Text property. Protection appears to be the mechanism that is used to prevent such an action.
Philip PinnellAuthor Commented:
Ha! I was trying to put it in the wrong bit. There is text under the graphic = bbRange.ContentControls.Item(5)

(Quite Easily Done)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now