我需要在我的文档(Grammarly)上运行文本检查程序,并且我需要删除所有表格。
我该怎么做?
我发现https://www.extendoffice.com/documents/word/1208-word-remove-delete-all-tables.html,您可以使用 VBA
Sub Removetables ()
Dim oTable As Table
Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable
End Sub
但Each oTable In ActiveDocument.Tables
运行它时出现错误。我在 Mac 上使用 MS Word 2013
答案1
您缺少For
了For Each
:
Sub Removetables ()
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable
End Sub