cqc*_*991 5 vba microsoft-word
我需要在我的文档(语法)上运行文本检查程序,我需要删除所有表格。
我该怎么做?
我发现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
Run Code Online (Sandbox Code Playgroud)
但是Each oTable In ActiveDocument.Tables
当我运行它时给我错误。我在 Mac 上使用 MS Word 2013
Atz*_*mon 12
你错过了For
in For Each
:
Sub Removetables ()
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
oTable.Delete
Next oTable
End Sub
Run Code Online (Sandbox Code Playgroud)