Bad hyperlinks in PDFs
Problem: Links in PDFs from PowerPoint don't work as expected
When you add hyperlinks to shapes in your slides then convert to PDF using Adobe Acrobat or PowerPoint's own Save As PDF feature, the links may point to the wrong slides or may not work at all. Read on for more detailed symptoms and possible workarounds.
Links applied to shapes with 3d formatting don't work
If you apply 3D formatting (bevels or the like) to a shape in PowerPoint 2010 and the shape has a hyperlink, when you convert to PDF using PowerPoint's own Save As | PDF feature, the link will not appear in the PDF.
If you use Adobe's Save As PDF add-in, the link will appear in the PDF but will take you to the slide you're already on, not to the correct slide.
This problem doesn't occur with PPTools' Prep4PDF add-in, which converts the links correctly.
The problem has been corrected in PowerPoint 2013. The links in PDFs made via PowerPoint's Save As | PDF feature work correctly.
Links point to the wrong slides
When you create hyperlinks and then rearrange or delete slides, then make a PDF using Adobe Acrobat, the links that Acrobat creates in the PDF may point to the wrong slides.
If you've re-ordered your presentation or added/deleted slides, make a copy of the presentation then run this macro on the copy of your presentation before using Acrobat to create a PDF.
But first, a word from our sponsor ... the PPTools Prep4PDF add-in takes care of this problem automatically. Try the free demo and see for yourself.
Sub FixForAcrobat() On Error GoTo ErrorHandler Dim oSl As Slide Dim oHl As Hyperlink Dim sSlideID As String Dim sSlideIndex As String Dim sSlideTitle As String Dim sTemp As String For Each oSl In ActivePresentation.Slides For Each oHl In oSl.Hyperlinks With oHl If .Address = "" Then ' it's a link to another slide in this pres ' verify that the slide number and ID of the link target match ' parse out slide number and slideID sSlideID = Mid$(.SubAddress, 1, InStr(.SubAddress, ",") - 1) sTemp = Mid$(.SubAddress, InStr(.SubAddress, sSlideID) + Len(sSlideID) + 1) sSlideIndex = Mid$(sTemp, 1, InStr(sTemp, ",") - 1) sSlideTitle = Mid$(sTemp, InStr(sTemp, ",") + 1) ' If the linked slide isn't present, we get an error so test first: On Error Resume Next If ActivePresentation.Slides.FindBySlideID(CLng(sSlideID)) Is Nothing Then MsgBox "Link to missing slide on slide: " & CStr(oSl.SlideIndex) _ & vbCrLf _ & "Link points to: " & .SubAddress ' stop processing this hyperlink Exit For End If On Error GoTo ErrorHandler If ActivePresentation.Slides.FindBySlideID(CLng(sSlideID)).SlideIndex <> sSlideIndex Then ' the link will confuse Acrobat so fix it Debug.Print "Originally:" & vbTab & .SubAddress On Error Resume Next sTemp = sSlideID & "," _ & ActivePresentation.Slides.FindBySlideID(CLng(sSlideID)).SlideIndex & "," _ & sSlideTitle ' If target slide not present, don't reset link If Err.Number = 0 Then .SubAddress = sTemp End If Debug.Print "Now:" & vbTab & sTemp End If End If End With Next Next NormalExit: Exit Sub ErrorHandler: MsgBox "Error:" & vbCrLf & Err.Number & vbTab & Err.Description Resume NormalExit End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.
PowerPoint stores several "pointers" in its internal hyperlinks. For each slide linked to, it stores the following information for the slide:
- The SlideID, a unique number assigned by PowerPoint, which never changes even when you reorder your presentation
- The SlideIndex, the current order of the slide within the presentation (ie, if SlideIndex = 42, then this is the 42nd slide in the presentation). This changes when you reorder the slides, of course.
- The title text of the slide
The second and third bits don't change as the result of editing the presentation, so the SlideID is the only reliable pointer to use. Acrobat evidently uses the SlideIndex, with the result that if you have a link from Slide 2 to Slide 10 and then delete Slide 4, the link will point to the slide that's NOW at Index 10, but was originally slide 11.
PowerPoint resolves the problem by using the SlideID when it follows the link; Acrobat produces a bad link in the PDF.
The macro above checks each hyperlink to make sure that the link's SlideIndex and the SlideID both point to the same slide. If they don't, it finds the Index of the slide at the SlideID and resets the link to it.