【问题标题】:VBA Code for Powerpoint, changes all MS Object (from Excel) of all slidesPowerpoint 的 VBA 代码,更改所有幻灯片的所有 MS 对象(来自 Excel)
【发布时间】:2019-07-09 04:59:12
【问题描述】:

我在 Powerpoint 中有很多幻灯片。都有到 Excel 表的 MS 对象连接。我正在寻找代码,以更改所有这些对象的大小和位置。我已经有一些代码了。但问题是它也会改变文本的大小和位置。有人知道如何改变它吗?

Sub ResizeAll()
For Each tSlide In ActiveWindow.Presentation.Slides
tSlide.Select
With tSlide.Shapes.Item(1)
'assume a blank slide with one image added only
   .Select
   .Height = 72 * 1000.39
   .Width = 72 * 10.67
'algin middle (Horizontal Center)
   .Left = 100
   .Top = ActivePresentation.PageSetup.SlideHeight / 5
End With
Next
End Sub

【问题讨论】:

    标签: vba powerpoint


    【解决方案1】:

    我会远离使用 Selection 对象。此代码检查形状是否为 OLE 对象,然后仅调整该形状的大小。如果这不能回答您的问题,请说明“也会更改文本的大小和位置”。

    Sub EnlargeExcelTables()
      Dim oSlide As Slide
      Dim oShape As Shape
      For Each oSlide In ActivePresentation.Slides
        For Each oShape In oSlide.Shapes
          If oShape.Type = msoLinkedOLEObject Then
            With oShape
              'Insert Size process here.
            End With
          End If
        Next oShape
      Next oSlide
    End Sub
    

    【讨论】:

    • 我在这个 PowerPoint 文件中使用表格,这些表格来自 Excel 作为 MS 对象连接。我希望所有幻灯片中的所有表格都具有相同的位置以及 weidht 和 heigt。
    • 但是我怎样才能取消锁定纵横比?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-02
    • 2015-11-22
    • 1970-01-01
    • 2014-01-15
    • 2019-05-07
    • 1970-01-01
    相关资源
    最近更新 更多