alt+F11,打开VB
Sub DeleteColumnsNamedDefaultValue()
Dim oTable As Table
Dim oCell As Cell
Dim iCol As Integer
Dim bFound As Boolean
' 遍历文档中的所有表格
For Each oTable In ActiveDocument.Tables
' 遍历表格中的所有列
For iCol = oTable.Columns.Count To 1 Step -1
bFound = False
' 检查每一列的第一个单元格是否包含“默认值”
For Each oCell In oTable.Columns(iCol).Cells
If oCell.Range.Text Like "*默认值*" Then
bFound = True
Exit For
End If
Next oCell
' 如果找到,则删除该列
If bFound Then
oTable.Columns(iCol).Delete
End If
Next iCol
Next oTable
MsgBox "完成删除所有名为'默认值'的列。"
End Sub