View Single Post
 
Old 02-01-2013, 02:38 PM
kisa500 kisa500 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Feb 2013
Posts: 4
kisa500 is on a distinguished road
Default Macro to update ole links not working

I found a macro that is supposed to update ole links in powerpoint but it doesn't seem to be working. Any suggestions?

Original source of macro: http://www.pptfaq.com/FAQ00759_Searc...link_paths.htm

VB Script with my mods:
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
    ' Include just the portion of the path you want to change
    ' For example, to change links to reflect that files have moved from
    ' \\boss\p-drive\temp\*.* to
    ' \\boss\Q-drive\temp\*.*
    sOldPath = "c:\Finance Pitch Automation\UK PDL Weekly Ops Pitch\"                                '"\\boss\p-drive\"
    sNewPath = "c:\Finance Pitch Automation\Development\UK PDL Weekly Ops Pitch\"                    ' "\\boss\q-drive\"
    
    On Error GoTo ErrorHandler

    For Each oSld In ActivePresentation.Slides
        For Each oSh In oSld.Shapes
            ' Change only linked OLE objects
            If oSh.Type = msoLinkedOLEObject Then
             '   On Error Resume Next
                ' Verify that file exists
               ' If Len(Dir$(Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath))) > 0 Then
                     oSh.LinkFormat.SourceFullName = Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath)
              '  Else
               '       MsgBox ("File is missing; cannot relink to a file that isn't present")
                End If
             '   On Error GoTo ErrorHandler
            ' End If
        Next    ' shape
    Next    ' slide

  MsgBox ("Done!")

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

End Sub
Reply With Quote