如何从PowerPoint自动打开链接/ URL?

时间:2020-01-07 14:16:36

标签: ms-office powerpoint

我在PPT中有一个链接/ URL,我想在幻灯片出现时打开它,而无需对其进行任何单击。可能吗? 谢谢

2 个答案:

答案 0 :(得分:1)

没有“简单”的方法可以做到这一点。当您尝试实现Office中非标准的功能时,必须使用VBA。

此代码行应可满足您的要求:

ActivePresentation.Slides(1).Hyperlinks(1).Follow

如果您不熟悉在Ppt中使用VBA,我建议您看一下指南,其中有很多在线指南:)

我希望这会有所帮助! 祝你有美好的一天

答案 1 :(得分:1)

Microsoft PowerPoint在幻灯片放映过程中为每个幻灯片触发OnSlideShowPageChange()事件。显示某些幻灯片时,您可以使用此功能来调用任何宏。 PowerPoint将对SlideShowWindow的引用作为参数传递给OnSlideShowPageChange()事件。

我假设您在幻灯片2上有一个超链接。因此,将以下代码复制到VBA模块中:

' --- The following macro displays a message when the second slide is shown.
' --- You are asked to open or not to open the link.
' --- The first link on slide 2 is opened when you click the OK button.

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
    If SSW.View.CurrentShowPosition = 2 Then
        MsgBox "Second slide in the slide show"
        result = MsgBox("Open URL?", vbOKCancel)
        If result = vbOK Then
            ActivePresentation.Slides(2).Hyperlinks(1).Follow
        End If
    End If
End Sub

当然,您可以删除无用的代码行,以解决消息和问题。