0

我有一个 Powerpoint 模板,标题幻灯片布局上的图片。用户可以打开自定义用户窗体来更改图片(VBA 删除旧图片,然后插入选择图片)。

但用户更改主题后,后续图片更改不可见。这是我所看到的,因为图片仅在原始主题的标题幻灯片布局中更改。更改主题实际上会添加一个新的幻灯片母版。

有没有办法在我的演示文稿中更改每个幻灯片母版的标题幻灯片布局上的图片?

这是VBA代码:

    Set shp = ActivePresentation.SlideMaster.CustomLayouts(1).Shapes(strShapeName)

    With shp
      sngTop = .Top
      sngLeft = .Left
      sngWidth = .Width
      sngHeight = .Height
      .Delete
    End With

    Set shp = ActivePresentation.SlideMaster.CustomLayouts(1).Shapes.AddPicture _
      (strFullFileName, msoFalse, msoTrue, _
      sngLeft, sngTop, sngWidth, sngHeight)

    With shp
      .ZOrder msoSendToBack
      .Name = strShapeName
    End With

感谢您的任何建议。

4

1 回答 1

1

尝试这样的事情:

Dim oDes As Design
Dim shp As Shape

For Each oDes In ActivePresentation.Designs
    Set shp = oDes.SlideMaster.CustomLayouts(1).Shapes(strShapeName)

    With shp
      sngTop = .Top
      sngLeft = .Left
      sngWidth = .Width
      sngHeight = .Height
      .Delete
    End With

    Set shp = oDes.SlideMaster.CustomLayouts(1).Shapes.AddPicture _
      (strFullFileName, msoFalse, msoTrue, _
      sngLeft, sngTop, sngWidth, sngHeight)

    With shp
      .ZOrder msoSendToBack
      .Name = strShapeName
    End With

    Next    ' Design
于 2015-11-26T16:54:04.450 回答