Convert PowerPoint tables to HTML
Problem
You have a table in PowerPoint and want to use it as a stand-alone web page or to include it as a table in another web page you're building. Saving the slide as HTML results in very complex, uneditable HTML that you can't easily use in another program.
Solution
Select the PowerPoint table you want to convert to HTML then run the macro below.
Sub TableToHTML() Dim oTable As Table Dim oSh As Shape Dim lColumn As Long Dim lRow As Long Dim sTableHTML As String ' No error checking here ' It's up to user to select a PowerPoint table before running this ' Note: POWERPOINT table, not pasted Word or Excel tables ' Start table off: sTableHTML = "<html>" & vbCrLf _ & "<head>" & vbCrLf _ & "</head>" & vbCrLf _ & "<body>" & vbCrLf & vbCrLf _ & "<table>" & vbCrLf Set oTable = ActiveWindow.Selection.ShapeRange(1).Table With oTable For lRow = 1 To .Rows.Count sTableHTML = sTableHTML & vbTab & "<tr>" & vbCrLf For lColumn = 1 To .Columns.Count sTableHTML = sTableHTML _ & vbTab & vbTab & "<td>" _ & .Cell(lRow, lColumn).Shape.TextFrame.TextRange.Text _ & "</td>" & vbCrLf Next sTableHTML = sTableHTML & vbTab & "</tr>" & vbCrLf Next End With ' finish up sTableHTML = sTableHTML & "</table>" & vbCrLf _ & "</body>" & vbCrLf _ & "</html>" & vbCrLf ' display the result in Immediate window ' Press Ctrl+G if you don't see the output Debug.Print sTableHTML ' Save to file Dim iFileNum As Integer iFileNum = FreeFile() Open "C:\Table.htm" For Output As #iFileNum Print #iFileNum, sTableHTML Close #iFileNum End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.