This code pastes my current selection from Excel into a new slide on the current PPT presentation I have open. I need it to paste to the current slide I am on rather than a new slide.
Any advice is greatly appreciated.
Sub ExcelRangeToPowerPoint()
Dim rng As Range
Dim PowerPointApp As Object
Dim myPresentation As Object
Dim mySlide As Object
Dim myShape As Object
Set rng = Selection
rng.Copy
On Error Resume Next
Set PowerPointApp = GetObject(class:="PowerPoint.Application")
Err.Clear
If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject(class:="PowerPoint.Application")
If Err.Number = 429 Then
MsgBox "PowerPoint could not be found, aborting."
Exit Sub
End If
On Error GoTo 0
Set myPresentation = PowerPointApp.ActivePresentation
Set mySlide = myPresentation.Slides.Add(1, 11) '11 = ppLayoutTitleOnly 'THIS IS WHAT I NEED HELP WITH
mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
myShape.Left = 66
myShape.Top = 152
PowerPointApp.Visible = True
PowerPointApp.Activate
Application.CutCopyMode = False
End Sub
Code listed was modified from -
https://www.thespreadsheetguru.com/b...point-with-vba