How to copy an excel chart and paste into PowerPoint slide in the correct position

  • Hi experts,


    I am using the below code to copy and paste charts into a PowerPoint presentation, however I would like to paste in the correct (height and width). I am using PasteSpecial to paste but not sure how to position the pic.


    Sub ExceltoPowerPoint()

    Dim PowerPointApp As Object
    Dim myPresentation As Object

    Set PowerPointApp = GetPowerPointApp()
    Set myPresentation = PowerPointApp.Presentations.Add

    Call createPlanOverviewSlide(myPresentation, ThisWorkbook.ActiveSheet.Range("B3:N30"))

    PowerPointApp.Visible = True
    PowerPointApp.Activate

    Application.CutCopyMode = False




    Sub createPlanOverviewSlide(ByVal myPresentation As Object, ByRef rng As Range)

    'Create new slide------------------------------------------------------------------------------------------------------

    Set myslide = myPresentation.Slides.Add(myPresentation.Slides.Count + 1, 12) '11 = ppLayoutTitleOnly

    'Copy range and paste to powerpoint------------------------------------------------------------------------------------

    rng.Copy
    myslide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile



    End Sub