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

x
  • 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?

TIA
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) _
        .Categories("General").BuildingBlocks("Graphic")
    
    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

0
Philip Pinnell
Asked:
Philip Pinnell
  • 2
1 Solution
 
GrahamSkanRetiredCommented:
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.
0
 
Philip PinnellAuthor Commented:
Ha! I was trying to put it in the wrong bit. There is text under the graphic = bbRange.ContentControls.Item(5)
0
 
GrahamSkanRetiredCommented:
QED

(Quite Easily Done)
0

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