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:
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: