Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button


Auto Hyperlink Text

Suppose you insert a text hyperlink to slide 5 that looks like this:

Link to Slide <5> (Datasheet)

Now if you add or delete slides before 5 or reorder the slides then the link will still work just fine. However the number in the link text will no longer be correct.

This vba adjusts the numbers in link text so that they ARE correct.

NOTE THAT YOUR NUMBER MUST BE IN THE FORM <xx> and this only works for text hyperlinks.

Dim ohl As Hyperlink
Dim newtxt As TextRange
Dim Ipos1 As Integer
Dim Ipos2 As Integer
Dim InewID As Integer
Dim InewIndex As Integer
For Each osld In ActivePresentation.Slides
For Each ohl In osld.Hyperlinks
If TypeName(ohl.Parent.Parent) = "TextRange" Then
InewID = Left$(ohl.SubAddress, 3)
InewIndex = ActivePresentation.Slides.FindBySlideID(CInt(InewID)).SlideIndex
Ipos1 = InStr(1, ohl.TextToDisplay, "<")
Ipos2 = InStr(1, ohl.TextToDisplay, ">")
If Ipos1 <> 0 And Ipos2 <> 0 Then
ohl.TextToDisplay = Left$(ohl.TextToDisplay, Ipos1 - 1) & _
"<" & CStr(InewIndex) & ">" & Right$ _
(ohl.TextToDisplay, Len(ohl.TextToDisplay) - Ipos2)
End If
End If
Next ohl
Next osld
Exit Sub
errhandler:
MsgBox "**ERROR**" & vbCrLf & "Error is " & Err.Description
End Sub

Don't know how to use vba? See Here

 
 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation