'VBA copy Excel table to existing Powerpoint table on a specific slide - keep destination formatting

Good afternoon!

I have been trying to use VBA to copy a table from Excel to an already created table (Table 9) on slide 30 in an already opened Powerpoint presentation (using Excel and Powerpoint 2010). I am also trying to keep the original Powerpoint formatting for the data and table.

I have tried multiple different approaches with no luck .... even trying to just update one value in the table but isn't working either. I have to update multiple tables in this presentation from excel.

I tried the Paste Link as well but this is not a good solution as the presentation may change.

Hopefully someone smarter than I am can be of help with this.

Set pp_App = GetObject(, "PowerPoint.Application")
pp_App.Visible = True

Worksheets("SMID Basket").Select
Worksheets("SMID Basket").Range("I5").Copy ' ))))))))))) works )))))))))))))))

pp_App.ActivePresentation.Slides(30).Select
pp_App.ActivePresentation.Slides(30).Shapes("Table 9").Table.Cell(2, 2).Select ' (((((((((( doesn't work (((((((((((

With Selection
    .PasteSpecial ppPasteDefault
    '.PasteSpecial ppPasteText
    ' .PasteSpecial DataType:=ppPasteDefault
    ' .PasteSpecial DataType:=ppPasteShape
End With

Love this forum .... look at it all of the time when stuck with VBA coding.

Thank you so much for your kind assistance with this!

Ladyred

I tried to post the code but keep getting error messages :-(



Solution 1:[1]

You Need to use Text Frame Property of Cell, check below snippet Shape is PowerPoint Table with ShapeType

     i = 1
    For j = config.StartingColumn To dataRange.columns.Count + config.StartingColumn - 1
        Set tempRange = dataRange.Cells(i, j - config.StartingColumn + 1)
        With shape.Table.Cell(i, j).shape
            .TextFrame.TextRange.Text = tempRange.Offset(-1, 0).Value
            .TextFrame.TextRange.Font.Size = 10
            .TextFrame.TextRange.Font.Name = "Arial"
        End With
    Next

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Calculator