0

I'm trying to change the Tag of a bunch of CheckBoxes (Content Control), so the tags match the CheckBox row position on a table.

Ex.: If CheckBoxes are positioned on row 4, i want all of them to have the same tag (like Row4,or something like that).

Is this possible or the Tag property is only for reading purpose?

I'll be gratefull on any advise. Thanks in advance!

Image of the table bellow

enter image description here

  • [you can type name as Array in the form](https://stackoverflow.com/questions/20184670/html-php-form-input-as-array) – OtiK.cz Jan 21 '22 at 17:03
  • I assume your checkboxes are content controls. You can find a lot of vba manipulation of Content Controls on Greg Maxey's site to get you started. http://gregmaxey.com/word_tip_pages/content_controls.html I expect that your question will be closed without answers. See https://stackoverflow.com/help/how-to-ask. – Charles Kenyon Jan 21 '22 at 17:20
  • Thanks for the link. I did something wrong on this question? – Renan Liporaci Jan 21 '22 at 17:24
  • Typically when posting your problem it's good to include (eg) some code you already tried, or what research you did to try to solve it before posting, and what *specific* problem you're having when trying to implement what you describe. – Tim Williams Jan 21 '22 at 17:31

1 Answers1

1

A basic example:

Sub Tester()
    Dim cc As ContentControl, i As Long, tbl As Table, rw As Row
    
    Set tbl = ThisDocument.Tables(1)
    For Each rw In tbl.Rows
        i = i + 1
        For Each cc In rw.Range.ContentControls
            If cc.Type = wdContentControlCheckBox Then
                Debug.Print cc.Tag
                cc.Tag = "Row_" & i
            End If
        Next cc
    Next rw
End Sub
Tim Williams
  • 154,628
  • 8
  • 97
  • 125