希望这可以帮助,
Option Explicit
Private Sub myTableMacro()
Dim tmpTable As Word.Table, tmpRange As Word.Range
With ActiveDocument
If .Tables.Count > 0 Then
For Each tmpTable In .Tables
'Rename col 2 heading from Time to Item
tmpTable.Cell(1, 2).Range.Text = "Item"
'Rename col 3 heading from Time Zone to Comment
tmpTable.Cell(1, 3).Range.Text = "Comment"
'Rename col 5 heading from Type to E or A
tmpTable.Cell(1, 5).Range.Text = "E or A"
'Delete all text in cols 2, 3 (but not the headers)
Set tmpRange = .Range(tmpTable.Cell(2, 2).Range.Start, tmpTable.Cell(tmpTable.Rows.Count, 3).Range.End)
tmpRange.Select
Selection.Delete Unit:=wdCharacter, Count:=1
'Delete all text in cols 5 (but not the headers)
Set tmpRange = .Range(tmpTable.Cell(2, 5).Range.Start, tmpTable.Cell(tmpTable.Rows.Count, 5).Range.End)
tmpRange.Select
Selection.Delete Unit:=wdCharacter, Count:=1
'Delete cols 10, 11
Set tmpRange = .Range(tmpTable.Cell(1, 9).Range.Start, tmpTable.Cell(1, 11).Range.End)
tmpRange.Select
Selection.Cells.Delete wdDeleteCellsEntireColumn
'Delete cols 6, 7, 9
Set tmpRange = .Range(tmpTable.Cell(1, 6).Range.Start, tmpTable.Cell(1, 7).Range.End)
tmpRange.Select
Selection.Cells.Delete wdDeleteCellsEntireColumn
Next 'tmpTable
End If
End With
Set tmpRange = Nothing
Set tmpTable = Nothing
End Sub
我测试过,发现OK。