how to change the source of PPT and update the links.

Rahul Rawat
Rahul Rawat used Ask the Experts™
on
I have one PPT which is linked to excel for exa , if i one to make presentaion of feb'17 month so i want to update the link through Feb'16 master sheet and if i want to make the Presentaion of Mar'17  so i want to use Mar'17 master dump.

can you guys please help me to Provide VBA code that every time i select my excel path ( Master Excel sheet path from where all PPT i want to create ) so all PPT's get updated...

please help me out,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Information Security Officer
Commented:
Sub changeLinkTargets()

Dim pptSlide As Slide
Dim pptShape As Shape

Dim oldString As String
oldString = "\\serverXY\DataFiles"
Dim newString As String
newString = "\\serverAQ\DataFiles"

For Each pptSlide In ActivePresentation.Slides
    For Each pptShape In pptSlide.Shapes
        If pptShape.Type = msoLinkedOLEObject Or pptShape.Type = msoLinkedPicture Then
            With pptShape.LinkFormat
                If InStr(1, UCase(.SourceFullName), UCase(oldString)) Then
                    .SourceFullName = Replace(.SourceFullName, oldString, newString)
                End If
            End With
        End If
    DoEvents
    Next pptShape
DoEvents
Next pptSlide

End Sub

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial