PDA

View Full Version : [SOLVED:] Return Tag of selected Content Control



DennyCrane
11-15-2018, 04:25 AM
Hey there,

I'm trying to receive the tag of a content control.

im using

Selection.Information(wdInContentControl)

to check if the cursor is currently in a content control. Now I have to find out, which tag is assigned to this selected content control.

Any ideas, hints or solutions?

Greetings

DennyCrane

gmayor
11-15-2018, 05:28 AM
Try the following

Dim oCC As ContentControl
Set oCC = Selection.Range.ParentContentControl
If Not oCC Is Nothing Then
MsgBox oCC.Tag
Else
MsgBox "The cursor is not in a content control"
End If

DennyCrane
11-15-2018, 06:22 AM
Thank you, works fine.