2

I'm experiencing SLOW changing, NOT updating, the links in powerpoint presentation for linked objects. Sample codes are as below:

 For Each sld In ActivePresentation.Slides
    For Each shp In sld.Shapes
       If shp.Type = msoLinkedOLEObject Then 
            Src_Old = Split(shp.LinkFormat.SourceFullName, "!")(0)
            Src_New = Src_Path & "\" & Src_Book_Name
            shp.LinkFormat.SourceFullName = Replace(shp.LinkFormat.SourceFullName, Src_Old, Src_New)
       End If           
    Next shp
Next sld

During each iteration, the external source file will be reopen and the link will be updated, which significantly slow down the running. So the questions are:

  1. Is there anyway to force NOT updating the link but just change the texts for SourceFullName?
  2. Even if the answer is NO, is there anyway to stop reopening the external source files each iteration?

Thanks in advance.

Steve Z.
  • 93
  • 9

2 Answers2

1

I experienced the same problem. This single command line was taking up to 16 seconds to execute. Changing the update method to manual improved to 11 seconds. What really solved was opening the reference file in backgound, without even showing to user, in read only node. Down to 0.6 seconds. Also valid to the update method.

Dim xlApp As Object
Dim xlWorkBook As Object

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
xlApp.DisplayAlerts = False
 Set xlWorkBook = xlApp.Workbooks.Open(strDBPath, False, True)

When you finish dont forget to clean up the mess.

xlWorkBook.Close
Set xlWorkBook = Nothing
xlApp.Quit
Set xlApp = Nothing
  • this worked for me. It improved speed from 1 minute per change of SourceFullName to a fraction of a second – intrixius Mar 28 '18 at 14:08
0

Can you try switching to manual update mode by using this before changing the SourceFullName property:

shp.LinkFormat.AutoUpdate = ppUpdateOptionManual

And then using the Update method to manually refresh the content when needed:

shp.LinkFormat.Update

You might also be able to use the BreakLink method but I'm not sure if this is what you want:

shp.LinkFormat.BreakLink
Jamie Garroch - MVP
  • 2,839
  • 2
  • 16
  • 24