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

Use ShellExecute to sidestep certain linking problems

Problem

Some programs don't cooperate with PPT when you link to their files. The first release of Adobe Reader 7 is one example. When you set an Other File action setting in PowerPoint to open a PDF and click the link in slide show view, either nothing happens or you see a brief blink of Reader, which then disappears. And then nothing happens. (Note: this problem has been fixed in the 7.0.1 update to Reader).

Either way, you don't see the PDF you were expecting to view.

If you plan to run your presentation in PowerPoint, try the following VBA macro as a possible solution.
This won't work in the free PowerPoint viewers, and it won't work if your Macro security settings are on High.

To use it:

Now put the file in SlideShow view and click the shape to see if it launches the document.

If it works, send a virtualkiss, money, whatever to Charles Wannall, whose post on the Adobe newsgroup suggested this workaround.

Solution

Option Explicit

Const SW_SHOWNORMAL As Long = 1

Declare Function ShellExecute Lib "shell32.dll" Alias _
         "ShellExecuteA" (ByVal Hwnd As Long, _
         ByVal lpOperation As String, _
         ByVal lpFile As String, _
         ByVal lpParameters As String, _
         ByVal lpDirectory As String, _
         ByVal nShowCmd As Long) As Long

Public Sub AssignTag()
' Select a shape and run me:

    With ActiveWindow.Selection.ShapeRange(1)
        If .ActionSettings(ppMouseClick).Hyperlink.Address <> "" Then
             Call .Tags.Add("FILENAME", .ActionSettings(ppMouseClick).Hyperlink.Address)
             .ActionSettings(ppMouseClick).Run = "ShellExShape"
        End If
    End With

End Sub

Public Sub ShellExShape(oSh As Shape)
' Assign this macro as the shape's action setting

   Dim sFileName As String

   On Error GoTo ErrorHandler

   ' Get the name of the file assigned to the shape as a tag
   sFileName = oSh.Tags("FILENAME")

   ' ShellExecute the file if one's listed
   If Len(sFileName) > 0 Then
      Call ShellExecute(0, "Open", sFileName, "", "C:\", SW_SHOWNORMAL)
   End If

NormalExit:
   Exit Sub
ErrorHandler:
   Resume NormalExit

End Sub

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

Search terms:


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

Use ShellExecute to sidestep certain linking problems
http://www.pptfaq.com/FAQ00689_Use_ShellExecute_to_sidestep_certain_linking_problems.htm
Last update 07 June, 2011
Created: