The correct code is:
Sub Removetables ()
Dim oTable As Table
[b]For[/b] Each oTable In ActiveDocument.Tables
Remove all tables in Word is usually applied in daily office working, and how can you quickly remove all tables? This tutorial will introduce three simple ways for you to remove all tables.
Generally speaking, it's easy to remove a table in Word. However, it will time-consuming and tedious to remove multiple tables one by one manually. Here, with the Remove Tables feature of Kutools for Word, you can easily remove all tables from a certain selection or the entire Word document with only one click!
60-day free trial!
Actually, you can remove a table manually in Word. Please do as follow:
In the Word, put cursor into the specified table to activate it, next click the cross at the top-left corer of the table to select the whole table, and then select Delete > Delete Table to remove it. See screenshot:
Note: You can also put the cursor into the specified table to activate it, and then click Layout > Delete > Delete Table to remove this table. See screenshot:
It will be time-consuming to remove multiple tables one by one manually with above method. Here, this method will introduce a VBA to batch remove all table from the current Word document at once. Please do as follows:
1: Press Alt+F11 to open the Microsoft Visual Basic for Applications window;
2: Click Insert > Module, and paste below VBA code into the Module window;
VBA: Remove all tables from the current Word document
Sub Removetables () Dim oTable As Table For Each oTable In ActiveDocument.Tables oTable.Delete Next oTable End Sub
3: Click Run button or press F5 key to apply the VBA.
Some users may not be familiar with VBA code. Take it easy! Kutools for Word's Remove Tables utility will help you remove all tables from a certain selection or the whole document at once with only one click!
Just click Kutools > Remove > Remove Tables, and all tables will be removed from the current Word document immediately.
Note: If you want to remove all tables from a certain selection, please select the part of document firstly, and then click Kutools > Remove > Remove Tables.