View Single Post
 
Old 02-04-2013, 09:57 AM
kisa500 kisa500 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Feb 2013
Posts: 4
kisa500 is on a distinguished road
Default

So it seems that the problem was with the replace statement. Modified code thus and this seems to work, hopefully this will help others as I found several other posts showing that this macro didn't work for them but without a clear/simple solution.

Code:
Sub ChangeOLELinks()

    Dim oSld As Slide
    Dim oSh As Shape
    Dim sOldPath As String
    Dim sNewPath As String
  
    ' EDIT THIS TO REFLECT THE PATHS YOU WANT TO CHANGE
    sOldPath = InputBox("Enter Old Project ie: \Development\", "Old Path") 
    sNewPath = InputBox("Enter New Project ie: \Test\", "New Path") 
     
    On Error GoTo ErrorHandler

    For Each oSld In ActivePresentation.Slides
        For Each oSh In oSld.Shapes
            If oSh.Type = msoLinkedOLEObject Then
            
                Dim stringPath   As String
                stringPath = Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath, 1, , vbTextCompare)
               
                oSh.LinkFormat.SourceFullName = stringPath
               ' set update mode to auto and update then set it back to manual
                oSh.LinkFormat.AutoUpdate = ppUpdateOptionAutomatic
                oSh.LinkFormat.Update
                oSh.LinkFormat.AutoUpdate = ppUpdateOptionManual
                               
            End If
        Next oSh
    Next oSld
    ActivePresentation.Save

MsgBox ("Done!")

NormalExit:
    Exit Sub
    
ErrorHandler:
    MsgBox ("Error " & Err.Number & vbCrLf & Err.Description)
    Resume NormalExit

End Sub
Reply With Quote