Word VBA设置所有图表宽度并居中
生活随笔
收集整理的這篇文章主要介紹了
Word VBA设置所有图表宽度并居中
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
設置word當前文檔所有圖表寬度為14cm并居中
alt+f11,新建模塊粘貼進去就能用 Sub ChangeChartWidthto14()Dim aktDocument As DocumentDim shp As ShapeDim oInLineSp As InlineShapeSet aktDocument = Word.ActiveDocumentWith aktDocumentFor Each shp In .Shapes'判斷shape是否是圖表If shp.HasChart Then'設置寬度14cmshp.Width = Application.CentimetersToPoints(14)'居中shp.Range.ParagraphFormat.Alignment = wdAlignParagraphCenterEnd IfNextFor Each oInLineSp In .InlineShapes'判斷inlineshape是否是圖表If oInLineSp.HasChart ThenoInLineSp.Width = Application.CentimetersToPoints(14)oInLineSp.Range.ParagraphFormat.Alignment = wdAlignParagraphCenterEnd IfNextEnd With End Sub
總結
以上是生活随笔為你收集整理的Word VBA设置所有图表宽度并居中的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 全球各地区当前对电子烟行业的政策如何?
- 下一篇: 人口预测模型基础介绍