Supercharge your PowerPoint productivity with
|
PPTools |
ProblemSome 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. 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: Español Deutsch Français Português Italiano Nederlands Greek Japanese Korean Chinese |
Supercharge your PPT Productivity with PPTools
|
content authoring & site maintenance by |
Use ShellExecute to sidestep certain linking problems
http://www.pptfaq.com/FAQ00689.htm
Last update 09 September, 2006