[VBA] Positioning Chart in Powerpoint after copy pasting from Excel
Results 1 to 2 of 2

Thread: [VBA] Positioning Chart in Powerpoint after copy pasting from Excel
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question [VBA] Positioning Chart in Powerpoint after copy pasting from Excel

    Hi, I'm not sure how to refer to a picture of a chart that was copied from excel and pasted into powerpoint. The macro copies 4 charts in total and pastes them into one slide. I looked at the selection panel and they are named Picture 1, Picture 2, Picture 3 and Picture 4. I tried referring to last pasted picture as an activeshape, but it doesn't work.

    Code:
    oCHT1.CopyPicture   'ActiveChart.ChartArea.Copy
       activeSlide.Shapes.Paste
       
       With activeshape
        .Height = 28.35 * 5 ' resize
        .Width = 28.35 * 11  ' resize
        .Top = 28.35 * 0.75    ' reposition
        .Left = 28.35 * 5.2   ' reposition
        End With

  2. #2
    MrExcel MVP
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    18,826
    Post Thanks / Like
    Mentioned
    35 Post(s)
    Tagged
    5 Thread(s)

    Default Re: [VBA] Positioning Chart in Powerpoint after copy pasting from Excel

    To refer to the last pasted picture, try...

    Code:
        With activeSlide
            With .Shapes(.Shapes.Count)
                .Height = 28.35 * 5 ' resize
                .Width = 28.35 * 11  ' resize
                .Top = 28.35 * 0.75    ' reposition
                .Left = 28.35 * 5.2   ' reposition
            End With
        End With
    Hope this helps!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •