VBA to paste to an existing table in PowerPoint

Stormcrow1776

New Member
Joined
Apr 7, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I am trying to copy a range from Excel and paste it to an existing table in PowerPoint. I am able to paste one range but when the try to populate multiple tables, it will only populate the last one requested.
VBA Code:
Sub Transfer()
Dim PPT As PowerPoint.Application
Dim PPTPres As PowerPoint.Presentation
Dim slide2 As PowerPoint.Slide

Set PPT = New PowerPoint.Application
PPT.Visible = msoTrue
PPT.Presentation.Open("\\link to my work desktop")
Set PPTPres = PPT.ActivePresentation
Set slide2 = PPTPres.Slides(2)

Dim source As Workbook
Dim highVal As Worksheet
Dim ppTable1 As PowerPoint.Shape
Dim ppTable2 As PowerPoint.Shape

Set source = Workbooks("Template.xlsm")
Set highVal = source.Worksheets("High $ Value")

PPT.ActiveWindow.View.GotoSlide(2)

Set pptTable1 = PPT.ActivePresentation.Slides(2).Shapes("Table 5")
highVal.Range("B3:K5").Copy
pptTable1.Table.Cell(3,2).Shape.Select
PPT.CommandBars.ExecuteMso ("PasteExcelTableDestinationTableStyle")

Set pptTable2 = PPT.ActivePresentation.Slides(2).Shapes("Table 6")
highVal.Range("A12:L26").Copy
pptTable2.Table.Cell(3,1).Shape.Select
PPT.CommandBars.ExecuteMso ("PasteExcelTableDestinationTableStyle")

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,215,545
Messages
6,125,450
Members
449,227
Latest member
Gina V

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top