Search code examples
vbachartspowerpoint

Change height of plot (inside chart) in PowerPoint chart


Will be great to get help, i've been trying to figure out a way to change height of a plot inside chart in PowerPoint slide, i got a code by which we can change the dimensions of chart, but not plot size. Can anyone help ..!!


Sub AllChartsResize()

Dim sld As Slide
Dim shp As Shape
Dim sr As Series
Dim chrt As Chart

'r converts cm to points
r = 28.3464567

    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            If shp.HasChart Then
            
                shp.Height = 15 * r
                shp.Width = 26 * r
                shp.Left = 7 * r
                shp.Top = 2 * r
            End If
            
   
    Next shp
    Next sld

End Sub


Solution

  • This is called the PlotArea and can be accessed:

    If shp.HasChart Then
        Dim pa as PlotArea: set pa = shp.Chart.PlotArea
        pa.Height etc.
    

    Now you can change its dimensions as you did with the Shape..