用于自动更新PowerPoint链接到Word的VBA代码

时间:2015-08-19 20:24:48

标签: vba ms-word powerpoint office-2013

我有数百个PowerPoint演示文稿,它们都将Word对象链接在其中。如何在不打开每个演示文稿的情况下自动更新所有链接?我假设它将用VBA完成,但我能找到的唯一VBA示例是用于自动更新链接的Excel对象。我对VBA不熟悉修改代码。

最终,我想通过命令提示符运行它。

使用PowerPoint& Word 2013。

1 个答案:

答案 0 :(得分:0)

DragonSamu是对的...但是为了让你开始,从PPT本身尝试这个,然后找出如何用脚本语言或者编译成EXE的东西重写它

对于要处理的每个文件,打开文件(通过代码),然后

Call UpdateLinks(ActivePresentation)


Sub UpdateLinks(oPres As Presentation)

    Dim oSl As Slide
    Dim oSh As Shape

    For Each oSl In oPres.Slides
        For Each oSh In oSl.Shapes
            If oSh.Type = msoLinkedOLEObject Then
                oSh.LinkFormat.Update
            End If
        Next
    Next

End Sub