单击一只鼠标,在一只鼠标中运行宏和超链接



我需要在PowerPoint幻灯片中的按钮,当我单击它时,它将,1(运行一个宏和2(超链接到同一演示文稿中的另一个幻灯片。

我只能看到一种做一个或另一个做的方法,而不是同时进行。

我的宏代码是:

Sub question1_real()
Dim oSh As Shape
   Dim oSl As Slide
   Dim lScore As Long
   ' By doing it this way it's easy to change to a different slide if you
   ' need to later for some reason:
   Set oSl = ActivePresentation.Slides(18)
   ' Change this if your shape is named something else:
   Set oSh = oSl.Shapes("TextBox 2")
   With oSh
      ' Make sure it's not blank to start with:
      If Len(.TextFrame.TextRange.Text) = 0 Then
          .TextFrame.TextRange.Text = "1"
      End If
      lScore = CLng(.TextFrame.TextRange.Text)
      lScore = lScore + 1
      .TextFrame.TextRange.Text = CStr(lScore)
   End With
End Sub

我的VBA技能为零。上述代码是从某人那里借来的。我在PowerPoint中使用了插入操作选项使其正常工作。

假设您已经给出了一个形状的运行宏动作设置并选择了您上面发布的子例程,则可以将此功能添加到VBA项目:

sub jumpto(lslideIndex长时间( slideshowwindows(1(.view.gotoslide(lslideIndex(结束子

然后,无论您想跳到另一个幻灯片,都这样称呼它:

Call JumpTo(42) ' or whatever slide you want to jump to

或只是

JumpTo 42

如果您需要在演示文稿中多次使用它,则将其放在功能中更加方便。如果严格来说是一次镜头,您可以将其粘贴到现有的代码中:

SlideShowWindows(1).View.GoToSlide (42)

最新更新