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

Posted on 2011-04-21
Last Modified: 2012-05-11
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

Question by:Philip Pinnell
    LVL 76

    Accepted 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.
    LVL 16

    Author Comment

    by:Philip Pinnell
    Ha! I was trying to put it in the wrong bit. There is text under the graphic = bbRange.ContentControls.Item(5)
    LVL 76

    Expert Comment


    (Quite Easily Done)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
    This article will show you how to use shortcut menus in the Access run-time environment.
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now