Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF

Show me the link and let me edit it

Problem

PowerPoint supplies no way to edit links to pictures or media files. The only way to access the link is via VBA.

Solution

Our FixLinks add-in will report on all the links in your presentation. The free demo prepares links to images so they don't break when you move the presentation to another disk drive or computer. The registered commercial version will do all that and prep sound, movie, image and document links so they don't break.

The PPTools Starter Set Plus (an inexpensive upgrade to our free Starter Set) includes a tool that allows you to edit individual links.

This macro will allow you to edit the link for any single currently selected shape.

Note that the linked file must be in the correct location before you edit the link to point to it. Otherwise, PowerPoint will not allow you to change the link.

Sub EditLink()
' Edit links of some types
' Little error checking.  It works or not.  No harm if not.

    Dim sLinkSource As String
    Dim sOriginalLinkSource As String

    If ActiveWindow.Selection.ShapeRange.Count <> 1 Then
      MsgBox ("Please select one and only one shape, then try again.")
      Exit Sub
    End If

    With ActiveWindow.Selection.ShapeRange(1)
        'MsgBox .LinkFormat.SourceFullName
        sOriginalLinkSource = .LinkFormat.SourceFullName
        sLinkSource = InputBox("Edit the link", "Link Editor", sOriginalLinkSource)

        If sLinkSource = sOriginalLinkSource Then
            ' nothing changed; our work on this planet is done
            Exit Sub
        End If
        If sLinkSource = "" Then
            ' The user canceled; quit:
            Exit Sub
        End If

        ' Get the filename portion of the link in case it's a link to a range
        Debug.Print Mid$(sLinkSource, 1, InStr(sLinkSource, ".") + 3)

        ' Is it a valid filename?  Is the file where it belongs?
        ' Test against the filename portion of the link in case the link includes
        ' range information
        If Dir$(Mid$(sLinkSource, 1, InStr(sLinkSource, ".") + 3)) <> "" Then
            .LinkFormat.SourceFullName = sLinkSource
            .LinkFormat.Update
        Else
            MsgBox "Can't find " & sLinkSource
        End If

    End With

End Sub

If you want to edit the Hyperlink Address of a shape's Action Setting, you can use the built-in editing features in PPT or use this macro intead:

Sub EditHyperLink()
' Edit hyperlink
' Little error checking. It works or not. No harm if not.


    Dim sAddress As String
    Dim sSubAddress As String
    Dim sTemp As String

    If ActiveWindow.Selection.ShapeRange.Count <> 1 Then
        MsgBox ("Please select one and only one shape, then try again.")
        Exit Sub
    End If

    With ActiveWindow.Selection.ShapeRange(1)
        ' you can substitute or repeat the process with .SubAddress if needed
        sAddress = .ActionSettings(ppMouseClick).Hyperlink.Address

        ' Get new address
        sTemp = InputBox("Edit the link address", "Link Editor", sAddress)

        If sTemp = sAddress Then
            ' nothing changed; our work on this planet is done
            Exit Sub
        End If
        If sTemp = "" Then
            ' The user canceled; quit:
            Exit Sub
        End If

        ' No tests for existence of file since it might be a URL or .... who knows what
        ' Just replace it
        .ActionSettings(ppMouseClick).Hyperlink.Address = sTemp

    End With

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2015 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.
Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Show me the link and let me edit it
http://www.pptfaq.com/FAQ00433_Show_me_the_link_and_let_me_edit_it.htm
Last update 16 October, 2013
Created: