How to Clear a Specific Table Style in Your Word Document

In this article, we are delighted to provide you with the method to clear a specific table style in your Word document.

Normally, in a document, there can be lots of document, applied with different styles. And we have explained ways to clear all table styles in one of our previous article. For detailed information, you can refer to this link: 3 Useful Methods to Batch Clear All Table Styles in Your Word Document

Now let’s see how to clear a particular table style from your Word document.Clear a Specific Table Style in Your Word Document

Method 1: Clear a Specific Table Style in One Document

  1. First of all, press “Alt+ F11” to trigger the VBA editor in Word.
  2. Then on the left column of the editor, click the “Normal” project.
  3. Next click the “Insert” on menu bar.
  4. On the drop-down menu, choose “Module”.Click "Normal"->Click "Insert"->Click "Module"
  5. Now you have inserted a module. Double click it to open its coding area and paste these codes there:
Sub ClearASpecificTableStyle()
  Dim objTable As Table
  Dim objDoc As Document
  Dim strStyleName As String
 
  Application.ScreenUpdating = False
 
  Set objDoc = ActiveDocument
  strStyleName = InputBox("Enter the name of table style which you want to clear: ", "Specify Table Style")
 
  For Each objTable In objDoc.Tables
    If objTable.Style = strStyleName Then
      objTable.Style = "Table Normal"
      objTable.Borders.Enable = True
    End If
  Next objTable
 
  Application.ScreenUpdating = True
 
  Set objDoc = Nothing
End Sub
  1. Then either click “Run” or hit “F5” to execute codes.Paste Macro->Click "Run"
  2. Now in the “Specify Table Style” box, enter the name of the style which you want to remove from the document.
  3. And click “OK” to move on.Enter Table Style Name->Click "OK"

Here is the possible result:Clear of a Specific Table Style

Method 2: Clear a Specific Table Style in Multiple Documents

Now in case there is a batch of files to process, you can utilize the following macro.

  1. To begin with, put all target documents in one same folder.
  2. Then repeat steps in method 1 to install and run a macro.
  3. But remember to replace macro with this one:
Sub ClearASpecificTableStyleInMultiDoc()
  Dim objTable As Table
  Dim objDoc As Document
  Dim StrFolder As String
  Dim strFile As String
  Dim strStyleName As String
  Dim dlgFile As FileDialog
 
  Set dlgFile = Application.FileDialog(msoFileDialogFolderPicker)
 
  With dlgFile
    If .Show = -1 Then
      StrFolder = .SelectedItems(1) & "\"
    Else
      MsgBox "Select a folder first."
      Exit Sub
    End If
  End With
 
  strStyleName = InputBox("Enter the name of table style which you want to clear: ", "Specify Table Style")
 
  strFile = Dir(StrFolder & "*.docx", vbNormal)
 
  While strFile <> ""
    Set objDoc = Documents.Open(FileName:=StrFolder & strFile)
    Set objDoc = ActiveDocument
 
    For Each objTable In objDoc.Tables
      If objTable.Style = strStyleName Then
        objTable.Style = "Table Normal"
        objTable.Borders.Enable = True
      End If
    Next objTable
 
    objDoc.Save
    objDoc.Close
    strFile = Dir()
  Wend
End Sub
  1. Next, there is the “Browse” window open. Just pick the folder you keep target documents and click “OK” to move on.Choose the Folder->Click "OK"
  2. Then there is the “Specify Table Style” box. Input style name and click “OK” to proceed.

Deal with Document Errors

There is always the possibility of getting Word broken. And the most devastating thing could be losing you valuable documents. Therefore, you must seize time to get a tool to fix Word in no time once the disaster happens.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xls recovery and pdf repair software products. For more information visit www.datanumen.com

Comments are closed.