6

I have a PowerPoint (2010) presentation with two slides. Both slides contain an image (two different images), and the presentation is set to loop infinitely until ESC is pressed.

An Excel file exports the two images used in the PowerPoint presentation every 5 minutes (they are charts, but I can't use a linked chart to the Excel file in PowerPoint, because PowerPoint ruins the chart somehow). The images are different from the original ones and Excel is set to overwrite the existing images. What I presume, is that PowerPoint loses the link to the file, since the 'new' image is different from the 'original' image.

Does anyone know a solution or an alternative method to do this?

2
  • It sounds like there is a better way than PowerPoint to do what you are trying to do.
    – Nattgew
    Jun 4, 2014 at 17:17
  • @fooot Do you have a suggestion for a program or application? Jun 4, 2014 at 17:23

2 Answers 2

6

I've run into this myself for updating weather images from the Internet during a slideshow.

Since Powerpoint stores the image files within itself while the slideshow is running, it does not update the images.

This means you have to trigger it to update the links by using VBA code or use an add in like; Update links during slide show Add-in for PowerPoint 97 or later or LiveImage - update inserted linked image real-time in PowerPoint.

I don't use that program any more and can not find the code I once used. The above information should help you get where you want to be.

1
  • Thanks, the VBA code helped me. I tweaked it a little bit, and now it works like it should. I'll post the code as an answer below. Jun 4, 2014 at 19:39
4

The following worked for me. First, install the add-in AutoEvents. In the example below, a continuous PowerPoint presentation of 2 slides is used (if you have more, change the if statement in the third macro to the number of your last slide). Create three subs, that do the same:

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

Auto_ShowBegin() and Auto_Open() are the same.

    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

And the third macro:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .