What kind of textbox?
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oCC As ContentControl
Dim oILS As InlineShape
'A formfield
If Selection.FormFields.Count = 1 Then
MsgBox Selection.FormFields(1).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
MsgBox Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If
'A content control
For Each oCC In ActiveDocument.Range.ContentControls
If Selection.Range.InRange(oCC.Range) Then MsgBox oCC.Title
Next oCC
'A activeX control
For Each oILS In ActiveDocument.InlineShapes
If Selection.Range.InRange(oILS.Range) Then
MsgBox oILS.OLEFormat.Object.Name
End If
Next
End Sub
See:
http://gregmaxey.com/word_tip_pages/...ng_macros.html for instructions to employ the VBA code provided above.