PowerPoint 中的链接图像未更新

Rob*_*sch 5 charts microsoft-powerpoint microsoft-excel

我有一个包含两张幻灯片的 PowerPoint (2010) 演示文稿。两张幻灯片都包含一个图像(两个不同的图像),并且演示文稿设置为无限循环,直到ESC按下 。

Excel 文件每 5 分钟导出一次 PowerPoint 演示文稿中使用的两个图像(它们是图表,但我无法在 PowerPoint 中使用链接到 Excel 文件的图表,因为 PowerPoint 以某种方式破坏了图表)。图像与原始图像不同,Excel 设置为覆盖现有图像。我认为 PowerPoint 丢失了文件的链接,因为“新”图像与“原始”图像不同。

有谁知道解决方案或替代方法来做到这一点?

Cha*_*eRB 6

我自己在幻灯片放映期间从 Internet 更新天气图像时遇到过这种情况。

由于 Powerpoint 在幻灯片放映时将图像文件存储在其自身中,因此它不会更新图像。

这意味着您必须使用VBA 代码或使用类似的插件来触发它来更新链接;在幻灯片放映期间更新链接 PowerPoint 97 或更高版本LiveImage 插件 - 在 PowerPoint 中实时更新插入的链接图像

我不再使用那个程序,也找不到我曾经使用过的代码。以上信息应该可以帮助你到达你想去的地方。


Rob*_*sch 4

以下内容对我有用。首先,安装插件AutoEvents。在下面的示例中,使用了 2 张幻灯片的连续 PowerPoint 演示(如果有更多幻灯片,请将第三个宏中的 if 语句更改为最后一张幻灯片的编号)。创建三个执行相同操作的子程序:

  1. Auto_ShowBegin()
  2. Auto_Open()
  3. Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)

Auto_ShowBegin() 和 Auto_Open() 是相同的。

    Sub Auto_ShowBegin()
        Dim sldTemp As Slide
        Dim lngTemp As Long
        Dim lngCount As Long
        Dim myImage As Shape

        For Each sldTemp In ActivePresentation.Slides
            For lngCount = sldTemp.Shapes.Count To 1 Step -1
                With sldTemp.Shapes(lngCount)
                    If .Type = msoPicture Then
                        .Delete
                    End If
                End With
            Next
        Next

        Set sldTemp = ActivePresentation.Slides(1)

        Set myImage = sldTemp.Shapes.AddPicture( _
        FileName:="C:\Users\Name\image1.png", _
        LinkToFile:=msoFalse, _
        SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
        Top:=(ActivePresentation.PageSetup.SlideHeight / 2))

        myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
        myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)

        Set sldTemp = ActivePresentation.Slides(2)

        Set myImage = sldTemp.Shapes.AddPicture( _
        FileName:="C:\Users\Name\image2.png", _
        LinkToFile:=msoFalse, _
        SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
        Top:=(ActivePresentation.PageSetup.SlideHeight / 2))

        myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
        myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)
    End Sub
Run Code Online (Sandbox Code Playgroud)

第三个宏:

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
    Dim sldTemp As Slide
    Dim lngTemp As Long
    Dim lngCount As Long
    Dim myImage As Shape
' AUTO UPDATE OF OLE LINKS MACRO
'
    If SSW.View.CurrentShowPosition = 2 Then
        For Each sldTemp In ActivePresentation.Slides
        For lngCount = sldTemp.Shapes.Count To 1 Step -1
            With sldTemp.Shapes(lngCount)
                If .Type = msoPicture Then
                    .Delete
                End If
            End With
        Next
    Next


    Set sldTemp = ActivePresentation.Slides(1)

    Set myImage = sldTemp.Shapes.AddPicture( _
    FileName:="C:\Users\Name\image1.png", _
    LinkToFile:=msoFalse, _
    SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
    Top:=(ActivePresentation.PageSetup.SlideHeight / 2))

    myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
    myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)

    Set sldTemp = ActivePresentation.Slides(2)

    Set myImage = sldTemp.Shapes.AddPicture( _
    FileName:="C:\Users\Name\image2.png", _
    LinkToFile:=msoFalse, _
    SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
    Top:=(ActivePresentation.PageSetup.SlideHeight / 2))

    myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
    myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)



    End If
End Sub
Run Code Online (Sandbox Code Playgroud)