BuJay
Board Regular
- Joined
- Jun 24, 2020
- Messages
- 75
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- Windows
I have a bunch of excel tables defined as named ranges, for Port_Table_1a, Port_Table_1b, Port_Table_1c, ...., all the way until Port_Table_22a, Port_Table_22b, and Port_Table_22c.
I also have an existing powerpoint with many slides.
How would I do the following:
Sub Macro1()
Range("Port_Table_1a").Select
Selection.Copy
End Sub
Sub OpenExistingPPTX()
Dim ppt As PowerPoint.Application
Set ppt = New PowerPoint.Application
ppt.Visible = True
ppt.Presentations.Open ("path")
Dim ppres As PowerPoint.Presentation
Set ppres = ppt.ActivePresentation
'Count number of slides in presentation
Debug.Print ppres.Slides.Count
End Sub
I also have an existing powerpoint with many slides.
How would I do the following:
- Open the powerpoint (I can do this with below code)
- Copy the first range (Port_Table_1a) from excel (I can do this with below code)
- Copy slide 5 from the open PowerPoint and insert it in the next slide location, so pasted into what would now by slide 6 and the previous slide 6 would now be moved to slide 7, etc.
- If there are any charts on the pasted slide 6, delete them
- Paste the first named range as an HTML into the new slide 6 centered vertically and horizontally
- Copy the second range (i.e., Port_Table_1b) from excel
- Copy slide 11 from the open PowerPoint and insert it in the next slide location, so pasted into what would now by slide 12 and the previous slide 12 would now be moved to slide 13, etc.
- If there are any charts on the pasted slide 12, delete them
- Paste the second named range as an HTML into the new slide 12 centered vertically and horizontally
Sub Macro1()
Range("Port_Table_1a").Select
Selection.Copy
End Sub
Sub OpenExistingPPTX()
Dim ppt As PowerPoint.Application
Set ppt = New PowerPoint.Application
ppt.Visible = True
ppt.Presentations.Open ("path")
Dim ppres As PowerPoint.Presentation
Set ppres = ppt.ActivePresentation
'Count number of slides in presentation
Debug.Print ppres.Slides.Count
End Sub