Stack Exchange
Text box 'Object does not support attached text' in Word 2016
I wrote a vba macro in order to print a number of raffle tickets in word. My vba code:
        For I = 1 To 10
            ActiveDocument.Shapes(1).TextFrame.TextRange.Text = N
            ActiveDocument.Shapes(2).TextFrame.TextRange.Text = N
            ActiveDocument.Shapes(3).TextFrame.TextRange.Text = N + 10
            ActiveDocument.Shapes(4).TextFrame.TextRange.Text = N + 10
            ActiveDocument.Shapes(5).TextFrame.TextRange.Text = N + 20
            ActiveDocument.Shapes(6).TextFrame.TextRange.Text = N + 20
            ActiveDocument.Shapes(7).TextFrame.TextRange.Text = N + 30
            ActiveDocument.Shapes(8).TextFrame.TextRange.Text = N + 30
            Application.PrintOut
            N = N + 1
        Next

However when I run it, i get the error:

The object does not support attached text

When I debug, the shapes(8) line of the vba code gets highlighted. The other 7 textboxes are filled correctly, and if I remove that last line of code, it prints fine, but the 8th text box obviously isnt getting filled. What am I missing here?

So I switched shapes(8) to shapes(9) and it worked. Could there a rogue textbox somewhere on the page? I couldn't find one. Or does word not reassign the indexes after a textbox is deleted?

My preference for this would be to use a TABLE with cells for the tickets... But FWIW anything that "floats" is a Shape, so if there are other things in the document that could account for the index. The index will be the anchor location, not the order you see the shapes. If you want to use Shapes I'd name them and work with the names. You might want to try Home/Editing/Select/Select objects to see all the Shapes...

I see this is more than a year old, but if someone lands here from Google search results, I was getting this exception when trying to assign value to MyShape.TextFrame.TextRange.Text, where MyShape was a ContentControl of type Checkbox. Remember that Checkbox and Picture Content Controls do not support attaching text to them.
