我有一个PowerPoint 2007幻灯片,其中有两个嵌入的Excel对象。 我想访问Sheet1选项卡并打破所有链接。 我试图按价值复制和粘贴,但我被困,虽然代码运行,但它没有。 任何帮助都非常感谢。

将暗点幻灯片 将Dim osheet作为对象 将Dim PPAPP为PowerPoint.Application 将Pppres暗淡为PowerPoint.pruseentation

在ActivePresentation.slides中的每个OSL 对于osl.shapes中的每个orhs

ActiveWindow.View.GotoSlide oSl.SlideIndex
    If oSh.Type = msoEmbeddedOLEObject Then
          oSh.OLEFormat.Activate
              With oSh.OLEFormat.Object

            .Application.Workbooks(1).Worksheets(1).Cells.Copy
           .Application.Workbooks(1).Worksheets(1).Cells.PasteSpecial Paste:=xlPasteValues


             End With


        ActiveWindow.Selection.Unselect
        ActiveWindow.View.GotoSlide oSl.SlideIndex

    End If

Next
.

下一个 结束子

有帮助吗?

解决方案

更新/编辑...跳过应用程序更新行,尝试如此,而不是:

If oSh.Type = msoEmbeddedOLEObject Then
    With oSh.OLEFormat.Object   ' added .Object here
        .Activate
        .Application.workbooks(1).worksheets(2).Cells.Copy
        .Application.workbooks(1).worksheets(2).Cells.PasteSpecial Paste:=xlPasteValues
    End With
End if
.

首先,将常量lxpastevalues定义为long= -4163或在上面的代码中替换与-4163的xlpastevalues。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top