How to Resize Excel Table Text After Pasting into PowerPoint Using VBA
Question details
The user wants to use a VBA script to automatically format and resize the text of an Excel table after it has been pasted into a PowerPoint presentation.

- Product
- Microsoft Excel and PowerPoint
- Device & OS
- not provided
- Scenario
- Automating the process of transferring an Excel range into a PowerPoint slide and programmatically adjusting its font size and row heights.
- Observed behavior
- When pasted as editable HTML, the table inherits smaller fonts and different row heights. Attempting to assign the selected ShapeRange directly to a table object causes a VBA type mismatch error.
Ensure you have the Developer tab enabled in your Office applications and verify that your macro security settings allow VBA code execution.
Use PowerPoint Shape Variables to Format the Pasted Table
Store the pasted Excel table as a PowerPoint Shape object to avoid type mismatch errors, then iterate through the table's cells to adjust the font size.
A common mistake when pasting Excel tables into PowerPoint via VBA is attempting to assign the newly pasted object directly to a Table variable. Because PowerPoint interprets the pasted HTML table as a Shape object first, this direct assignment results in a type mismatch error.
By correctly storing the object as a Shape, you can safely drill down into its Table property to manipulate text ranges, paragraph formatting, and row heights.
In your Excel VBA script, define and copy your target data range using the Range.Copy method.
Switch context to your PowerPoint slide and use the Shapes.PasteSpecial method to paste the data as an HTML format shape.
Assign the result of the paste operation to a standard PowerPoint Shape or ShapeRange object variable.
Access the .Table property of your Shape variable. Use a nested loop to iterate through each row and column, setting the .TextFrame.TextRange.Font.Size property for each cell to your desired value.

Try WPS Office for Seamless Spreadsheet and Presentation Management
If complex cross-application VBA scripting in Microsoft Office is slowing you down, consider switching to WPS Office. It provides a highly compatible, all-in-one environment for your documents, spreadsheets, and presentations.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installer.
- 2. Install the Suite: Run the installer and follow the on-screen prompts to set up the software on your computer.
- 3. Open Your Files: Launch WPS Office and open your existing Excel and PowerPoint files to continue working seamlessly.

Frequently Asked Questions
Why do I get a type mismatch error when handling a pasted table in PowerPoint VBA?
This error happens because an Excel table pasted as HTML into PowerPoint is initially recognized as a Shape object, not a Table object. You must assign it to a Shape variable first, then access its internal Table property.
Can I also automate row height adjustments after pasting?
Yes. Once you have referenced the Shape's Table property, you can loop through the Rows collection and set the .Height property for each row programmatically.
Does the PasteSpecial method affect how I can format the table?
Yes. If you paste the Excel data as an OLE Object or an image, you cannot iterate through the individual cells to change the font size in PowerPoint. Ensure you are pasting it as an HTML shape to retain cell-level formatting capabilities.




