VBA to format multiple Charts in Word Document

I had to format multiple charts in a Word Document and I wanted to keep them consistent across the document. So I wrote this small, simple VBA script to do it for me… nothing too fancy, and you can expand to suit your own needs

Sub ResizeCharts()
Dim inShp As InlineShape
For Each inShp In ActiveDocument.InlineShapes
  If inShp.Type = wdInlineShapeChart Then
    inShp.LockAspectRatio = msoFalse
    inShp.Width = CentimetersToPoints(15)
    inShp.Height = CentimetersToPoints(12)
    inShp.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
    inShp.Chart.ClearToMatchStyle
    inShp.Chart.HasLegend = False
    inShp.Chart.PlotArea.Position = xlChartElementPositionAutomatic
    inShp.Chart.PlotArea.InsideHeight = CentimetersToPoints(8)
    inShp.Chart.PlotArea.InsideWidth = CentimetersToPoints(8)
    inShp.Chart.ChartTitle.Position = xlChartElementPositionAutomatic
  End If
Next inShp
End Sub

About the author

lazypaddy

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.