VBA: Excel Chart to PowerPoint (2013 vs 2016) - shape size anomaly

Harry Flashman

Active Member
Joined
May 1, 2011
Messages
361
I send charts Excel to PowerPoint using VBA (pasted as a picture). In Excel < 2013 to either PowerPoint < 2013 or 2016 the shape arrives in PowerPoint with the same size as it was in Excel. However with Excel 2016 to Power 2016 the shape ends up being approx 125% of the original shape (yet strangely according to PowerPoint it is 93% of the original size if I inspect the shape's size properties).

While this is annoying, it is not that big a deal, as I can add some code to specify the size of shape once it reaches PowerPoint. However I am curious as to why this is happening. Has anyone else experienced this? Does anyone know why?

I should add that this does not occur if I copy/paste the chart (Excel to Powerpoint) as a picture manually.

This isn't the full routine, but it the relevant code:

Code:
Dim PPApp As Object ' As PowerPoint.Application
    Dim PPPres As Object ' As PowerPoint.Presentation
    Dim PPSlide As Object ' As PowerPoint.Slide
    Dim cht As Chart
    Set cht = Worksheets(strPivotMain).Shapes("Pivot_Main_Chart").Chart
    ' Make sure a chart is selected


        ' Reference existing instance of PowerPoint
        Set PPApp = GetObject(, "Powerpoint.Application")
        ' Reference active presentation
        Set PPPres = PPApp.ActivePresentation
        PPApp.ActiveWindow.ViewType = 1 ' 1 = ppViewSlide
        ' Reference active slide


        ' The value in brackets could be replaced with iSlide if there is a specific slide the chart is to be sent to
        Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)


        ' Copy chart as a picture
        cht.CopyPicture Appearance:=xlScreen, Size:=xlScreen, _
        Format:=xlPicture
        


        ' Paste chart
        PPSlide.Shapes.Paste
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top