Search and replace in PowerPoint hyperlinks

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?
 
J

John Wilson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top