I have a presentation with chart links to an Excel file, I have this simple code in an Excel file that opens the linked file, opens the PP, updates and removes the links, saves and closes. The issue with this code is that the links are not always updating. When I run this from the VB editor it works fine but I have this run on a daily schedule (using Workbook_Open and Application.OnTime) and it will not update the links when automatically running each day. All other aspects of the code run without issue and there are no errors. Here is the code, appreciate any assistance.
Private Sub Update_PP()
Dim PPT As New PowerPoint.Application
Dim sld As PowerPoint.Slide
Dim shp As PowerPoint.Shape
Workbooks.Open FileName:="C:Data FilesExcel File.xlsb"
PPT.Visible = msoTrue
PPT.Presentations.Open "C:Data FilesTemplate.pptx", ReadOnly:=msoFalse, WithWindow:=msoTrue
PPT.ActivePresentation.UpdateLinks
For Each sld In PPT.ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoLinkedOLEObject Then
shp.LinkFormat.BreakLink
End If
Next shp
Next sld
PPT.ActivePresentation.SaveAs FileName:="C:Data FilesNew Template.pptx"
PPT.ActivePresentation.Close
PPT.Quit
Set PPT = Nothing
End Sub
question from:
https://stackoverflow.com/questions/66047338/powerpoint-active-presentation-updatelinks-not-updating 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…