Search and replace in PowerPoint hyperlinks

  • Thread starter Thread starter rmccafferty
  • Start date Start date
R

rmccafferty

I have a very long presentation with countless hyperlinks, some of them used
over and over. I would like to do a search and replace that finds every
hyperlink to, say, Slide1 and change the hyperlink to be Slide2.

I do not see a way to do it with normal find and replace.

I know the hyperlinks are stored somewhere in PowerPoint, but cannot figure
out where, thinking that I might be able to make the changes there as long as
I can get it in a text format.

Anyone know how to do this?
 
First - are you quite sure you ned to do this? Internal links to slide depend
on the slide ID which is constant. This mean if you have several links
pointing at slide 2 and you then move the slide to say slide 10 position then
the links should still work.
Assuming you DO need to swap the links try this on a copy of your
presentation.

Sub relinker()
Dim osld As Slide
Dim origtarget As Slide
Dim newtarget As Slide
Dim ohlk As Hyperlink
Dim Ipos As Integer
On Error Resume Next
'**********************
'Change the numbers here
Set origtarget = ActivePresentation.Slides(2)
Set newtarget = ActivePresentation.Slides(10)
'**********************
For Each osld In ActivePresentation.Slides
For Each ohlk In osld.Hyperlinks
If ohlk.SubAddress <> "" Then
Ipos = InStr(ohlk.SubAddress, ",")
If Val(Left$(ohlk.SubAddress, Ipos - 1)) _
= origtarget.SlideID Then
ohlk.SubAddress = CStr(newtarget.SlideID) & "," & _
CStr(newtarget.SlideIndex) & "," & newtarget.Name
End If ' correct link to change
End If ' has subaddress (internal)
Next ohlk
Next osld
End Sub

How to use code
http://www.pptalchemy.co.uk/vba.html
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
PPTLive Atlanta Oct 11-14 2009
 
Back
Top