How to delete all tables from Word Document using VBA Code

Many professionals on daily basis in their workplace work with documents that contain a large number of tables. We know that deleting a single table is straightforward and can be done manually. However, deleting a large number tables from the entire document manually one by one is both time-consuming and tedious task. If you want and needs to delete all tables from word document, while leaving other content like text and images untouched, doing so manually becomes an even greater challenge. In this tutorial, I will show you how to automate and streamline the process, making it quicker and more efficient, so you can save valuable time.

To delete multiple tables in Word quickly, you can use either VBA code or a tool like Kutools. Here in this tutorial, I will guide you through both the process of using VBA code and Kutools to remove all tables from a document with just one click.

If you’d like to learn how to do this using Kutools, you can find detailed guide in the link below:

By the end of this tutorial, you will be able to delete all tables the entire word document with just a single click.

Follow these steps to delete all tables from Microsoft Word Document using VBA Code.

  1. Open Microsoft Visual Basic for Applications either by

Clicking on Developer Tab and then from Code group Click on Visual Basic

delete all tables from word document in one click

(Click Here to Show Developer Tab on ribbon)

                         OR

 From Keyboard just Press ALT+F11 Shortcut Key

delete all tables from word document in one click

2. From the Menu Click on Insert -> Click on Module and Past the following VBA code into the Module

Sub DeleteAllTables()
Dim tbl As Table
For Each tbl In ActiveDocument.Tables
tbl.Delete
Next tbl
End Sub

3. Click on Save icon (or Click on Run Icon or Press F5) and Close VBA Editor

delete all tables from word document in one click

( after clicking on Save icon, if the following message popup then click on “Yes” Button)

4. Press Alt +F8 Shortcut Key from Keyboard, the following Macros Dialog Box will appear, here select/click on your macros “deleteAllTables” and Click on RUN Button.

delete all tables from word document in one click

I hope this tutorial will help to delete or remove multiple tables from MS Word Document Using VBA Code. If you have any queries, suggestion or feedback feel free to contact us using the information provided on our contact us page.

Thank you.

Similar Posts