Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

excel - PowerPoint Active.Presentation.Updatelinks not updating

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...