Office Settings & Configuration

How to Remove Table and Shape Fills in PowerPoint Using VBA

Muhammad TalhaMuhammad Talha Oct 26, 2026 869 views

Question details

The user needs a way to bulk remove the background fills from all tables and text-containing shapes on a PowerPoint slide to easily overlay and compare different presentation versions.

Remove Table and Shape Fills in PowerPoint with VBA
Product
PowerPoint
Device & OS
not provided
Scenario
Comparing a newer version of a slide with an older version by making the new slide's tables and text shapes transparent and placing them over the old version to identify changes.
Observed behavior
PowerPoint does not have a single built-in command to batch remove fills from all objects at once, requiring manual adjustments or a custom VBA macro.
Before you start

Ensure that the Developer tab is enabled in your presentation software's ribbon to access the Visual Basic Editor, and save a backup copy of your file as a Macro-Enabled Presentation (.pptm) before running scripts.

Solution 1Recommended

Use a VBA Macro to Clear Fills from Tables and Shapes

Run a customized VBA macro that automatically loops through the selected slide, finds text-containing shapes and tables, and sets their fills to invisible.

This automated script is ideal for presentation comparison. It specifically targets any shape that has a text frame and any table on the current slide, bypassing empty shapes or pictures so your slide structure remains intact.

1
Open the Visual Basic Editor

In your presentation, navigate to the 'Developer' tab on the top ribbon and click on 'Visual Basic' (or press Alt + F11) to open the VBA Editor.

2
Insert a New Module

In the Visual Basic Editor, click 'Insert' from the top menu and select 'Module'. This will open a blank code window where you can write your script.

3
Paste the VBA Code

Copy and paste the following code into the module window: Sub UnFill() Dim oSh As Shape Dim lRow As Long Dim lCol As Long For Each oSh In ActiveWindow.Selection.SlideRange(1).Shapes If oSh.HasTextFrame Then If oSh.TextFrame2.HasText Then oSh.Fill.Visible = False End If If oSh.HasTable Then With oSh.Table For lRow = 1 To .Rows.Count For lCol = 1 To .Columns.Count .Cell(lRow, lCol).Shape.Fill.Visible = False Next lCol Next lRow End With End If Next oSh End Sub

4
Run the Macro

Close the VBA Editor. Select the slide you want to modify in normal view. Go back to the 'Developer' tab, click 'Macros', select 'UnFill' from the list, and click 'Run'. All applicable fills on that slide will be instantly removed.

Use a VBA Macro to Clear Fills from Tables and Shapes
Save as Add-in: If you plan to use this macro frequently for comparing different files, you can save your PPTM file as a PowerPoint Add-in (.ppam) so the command is always available in your software.

Run Macros and Edit Presentations Easily with WPS Office

WPS Presentation fully supports advanced VBA macros, allowing you to automate formatting tasks like removing table and shape fills exactly as you would in Microsoft PowerPoint.

  1. 1. Open WPS Presentation: Launch WPS Office and open your presentation file in the WPS Presentation module.
  2. 2. Access the Developer Tools: Click on the 'Developer' tab in the top menu to access the macro and VBA editor functionalities.
  3. 3. Create and Run Your Macro: Click 'Macros', create a new macro named 'UnFill', paste the provided code, and execute it to instantly make your slide elements transparent.
Fully compatible with Microsoft PowerPoint .ppt and .pptx formatsSupports VBA macro execution for advanced automationBuilt-in robust tools for slide comparison and editingLightweight, fast, and free to download
QA img-9

Frequently Asked Questions

Can I undo the VBA macro after running it?

Running a VBA macro generally clears the undo history in your presentation software. It is highly recommended to save a backup copy of your file before executing the macro so you can revert if needed.

Why isn't the Developer tab visible in my ribbon?

The Developer tab is typically hidden by default to simplify the interface. To enable it, go to File > Options > Customize Ribbon, and check the box next to 'Developer' in the right-hand pane.

Will this macro remove the fill from pictures or standard empty shapes?

No, the specific script provided only targets tables and shapes that contain a text frame with text. Standard decorative shapes without text and inserted pictures will remain completely unaffected.

How do I apply this macro to the entire presentation instead of just one slide?

To apply it to the whole presentation, you would need to add an outer loop to the VBA code that iterates through 'ActivePresentation.Slides' rather than just 'ActiveWindow.Selection.SlideRange(1)'.