Copying a chart in Excel and pasting it in a specific place in a Powerpoint slide ?

I have a simple code that copies the chart and places it in the middle of the Powerpoint slide
Dim PPApp  As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
    Set PPApp = GetObject(, "Powerpoint.Application")
    ' Reference active presentation
    Set PPPres = PPApp.ActivePresentation
    PPApp.ActiveWindow.ViewType = ppViewSlide

    ThisWorkbook.Sheets(1).ChartObjects("Chart 3").CopyPicture
    With PPPres.Slides(2).Shapes.Paste
        .Align msoAlignCenters, True
        .Align msoAlignMiddles, True
    End With

Open in new window

My primary question is how do I specify the exact position at which to paste the chart? I came across some code that will do the positioning but I can't figure out how to adapt it:
Set oSlide = ActivePresentation.Slides(lCurrSlide)
Set oShape = oSlide.Shapes.Paste
oShape.top = 10
oShape.Left = 10
oShape.Width = 282
oShape.Height = 192

Open in new window

Eventually I would also like to open the presentation based on these parameters but first I want to get the positioning done.

Thanks,
John
LVL 1
John CarneyReliability Business Tools Analyst IIAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John CarneyReliability Business Tools Analyst IIAuthor Commented:
I found some much simpler code that will position the chart exactly where I want it but it requires knowing the chart/picture's name in advance. How do I customize it so that it positions the newly pasted shape no matter what its name is?
PPPres.Slides(2).Shapes("Picture 19").top = 74
PPPres.Slides(2).Shapes("Picture 19").Left = 410

Open in new window

John CarneyReliability Business Tools Analyst IIAuthor Commented:
Well I finally figured it out, or so it seems. Here's what I've got right now:

Sub ChartToPresentation()
ActiveSheet.ChartObjects(Chrt).Select
ActiveSheet.ChartObjects(Chrt).CopyPicture
Dim PPApp  As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
    Set PPApp = GetObject(, "Powerpoint.Application")
    Set PPPres = PPApp.ActivePresentation
    PPApp.ActiveWindow.ViewType = ppViewSlide
   With PPPres.Slides(2).Shapes.Paste
    .top = 74
    .Left = 410
    End With
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John CarneyReliability Business Tools Analyst IIAuthor Commented:
Good work, John. If I do say so myself! :- )
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.