【问题标题】:Editing Embedded PowerPoint from Excel VBA从 Excel VBA 编辑嵌入式 PowerPoint
【发布时间】:2008-09-23 22:44:49
【问题描述】:

我在 Excel 工作簿中嵌入了 PowerPoint 演示文稿。如何使用 VBA 进行编辑(打开、复制幻灯片、向幻灯片添加数据、关闭)?

【问题讨论】:

    标签: excel powerpoint vba


    【解决方案1】:

    1.将 PowerPoint 对象模型的引用添加到您的 VBA 应用程序

    在 VBA 窗口中,选择 工具 |参考文献
    寻找 Microsoft Powerpoint 12.0 Object Library 并检查它

    2。选择并激活 PowerPoint 演示对象

    ActiveSheet.Shapes("Object 1").Select
    Selection.Verb Verb:=xlOpen
    

    注意:此代码假定 PowerPoint 对象被命名为 Object 1(查看左上角以查看它的真正名称)并且它位于活动工作表上。

    3.获取对 Presentation 对象的引用

    Dim p As PowerPoint.Presentation
    Set p = Selection.Object
    

    4.操纵它

    您可以使用演示对象的所有方法和属性。下面是添加幻灯片的示例:

    p.Slides.Add 1, ppLayoutBlank
    

    5.取消选择它

    最简单的方法就是选择一个单元格。

    [a1].Select
    

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多