Sub ProcessSelectedColumn()
Dim oTbl As Table
Dim oCell As cell
Dim iRow As Integer
Dim iCol As Integer
Dim oRange As Range
' 檢查是否有表格被選中
If Selection.Information(wdWithInTable) Then
' 獲取包含所選內(nèi)容的表格
Set oTbl = Selection.Tables(1)
' 遍歷選定列的每個單元格
For iRow = 1 To oTbl.Rows.Count
Set oCell = oTbl.cell(iRow, 2)
ActiveDocument.Indexes.MarkEntry Range:=oCell.Range, Entry:=oCell.Range.Text
Next iRow
Else
MsgBox "沒有選中表格或表格中的單元格。"
End If
End Sub