【问题标题】:Adjusting the size of SmartArt nodes using VBA for PowerPoint使用 VBA for PowerPoint 调整 SmartArt 节点的大小
【发布时间】:2015-03-04 04:44:27
【问题描述】:

我想知道是否有办法在 PowerPoint 2010 中使用 VBA 更改 SmartArt 对象的每个单独节点的宽度/高度。

我已尝试使用以下代码进行此操作,但最终收到一条错误消息:

ActivePresentation.Slides(i).Shapes(2).SmartArt.AllNodes(j).Shapes.Height = 100

我在 Word 2010 中找到了一个类似问题的链接,似乎无法使用 VBA 更改大小,因为 height 属性是只读的。 http://www.excelforum.com/word-programming-vba-macros/860581-word-2010-smartart-vba-how-to-change-size.html

如果有人知道在 VBA 中是否有可能的方法,请告诉我。谢谢!

【问题讨论】:

    标签: vba excel ms-word powerpoint


    【解决方案1】:

    这不是完整的答案,但希望它会有所帮助。您似乎无法单独更改节点的宽度或高度。但是您可以通过这种方式使节点变大或变小:

    'to enlarge
    ActivePresentation.Slides(i).Shapes(2).SmartArt.AllNodes(j).Larger
    
    'to make it smaller
    ActivePresentation.Slides(i).Shapes(2).SmartArt.AllNodes(j).Smaller
    

    【讨论】:

      【解决方案2】:

      您可以使用缩放,然后使用宽度属性来计算缩放因子。这种方法的缺点是它会影响对象的大小。我使用转换为形状来处理它。 SmartArts 很痛苦。

          Node.Shapes.ScaleWidth Application.CentimetersToPoints(4.5) / Node.Shapes.Height, msoFalse
      

      上面的代码会将你的宽度缩放到 4.5 厘米。

      【讨论】:

        【解决方案3】:

        你可以通过缩放来改变它(我认为):

        ActivePresentation.Slides(i).Shapes(2).SmartArt.AllNodes(j).Shapes.ScaleHeight  1.75, msoFalse, msoScaleFromTopToLeft
        

        【讨论】:

        • 语法错误,.ScaleHeight 是方法,不是属性
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-11-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多