Stormcrow1776
New Member
- Joined
- Apr 7, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- 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