我正在尝试根据回复推进幻灯片。如果用户选择easy,我想前进2张幻灯片,如果他们选择了硬盘,我想前进2张幻灯片。这是我目前的代码。 Nextpage脚本不起作用我希望它可以用于多个问题 - 我似乎无法使用幻灯片+1或幻灯片+2(或++)之类的东西。
Sub Start()
ActivePresentation.Slides(2).Shapes("selection_hard").Visible = False
ActivePresentation.Slides(2).Shapes("selection_easy").Visible = False
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub Shoe_Easy()
ShoeAnswer = "Easy"
ActivePresentation.Slides(2).Shapes("selection_hard").Visible = False
ActivePresentation.Slides(2).Shapes("selection_easy").Visible = True
'ActivePresentation.SlideShowWindow.View.GotoSlide (11)
End Sub
Sub Shoe_Hard()
ShoeAnswer = "Hard"
ActivePresentation.Slides(2).Shapes("selection_hard").Visible = True
ActivePresentation.Slides(2).Shapes("selection_easy").Visible = False
'ActivePresentation.SlideShowWindow.View.GotoSlide (12)
End Sub
Sub Nextpage()
If ActivePresentation.Slides(2).Shapes("selection_hard").Visisble = True Then
ActivePresentation.SlideShowWindow.View.GotoSlide (3)
ElseIf ActivePresenation.Slides(2).Shapes("selection_easy").Visible = True Then
ActivePresenation.SlideShowWindow.View.GotoSlide (4)
End If
End Sub
答案 0 :(得分:1)
假设"响应"意味着点击两种形状中的一种(简单或硬),这样就可以了。您只需要确保形状和下面的代码中的文本匹配,并将HandleClick宏指定为每个形状的RunMacro操作设置(将它们分配给其中两个,然后将形状复制/粘贴到其他位置需要)。
有一些额外的箍要跳过才能在Mac上运行;如果你也需要它在那里工作,那就喊。
Sub HandleClick(oSh As Shape)
' Did they click the Easy or Hard button?
' oSh contains a reference to the shape they clicked
' Look a the text in oSh to decide where to go next:
Select Case UCase(oSh.TextFrame.TextRange.Text)
Case Is = "EASY"
SlideShowWindows(1).View.GotoSlide (oSh.Parent.SlideIndex + 2)
Case Is = "HARD"
SlideShowWindows(1).View.GotoSlide (oSh.Parent.SlideIndex + 1)
Case Else
' Do nothing
End Select
End Sub
一旦点击,立即推进幻灯片。如果您希望用户能够选择答案然后前进,您需要采用不同的方法。
不是像上面那样立即推进,而是将全局变量的值设置为" EASY"或者" HARD",取决于用户的选择。
然后,在分配给前进按钮的单独宏中,您可以根据全局变量的值前进一个或两个幻灯片。
答案 1 :(得分:0)
我认为这样的事情可能有所帮助:
Nextpage()
Dim currentSlide as Slide
Set currentSlide = ActivePresentation.SlideshowWindow.View.Slide
If ActivePresentation.Slides(2).Shapes("selection_hard").Visisble = True Then
ActivePresentation.SlideShowWindow.View.GotoSlide currentSlide.SlideIndex + 1
ElseIf ActivePresenation.Slides(2).Shapes("selection_easy").Visible = True Then
ActivePresenation.SlideShowWindow.View.GotoSlide currentSlide.SlideIndex + 2
End If
End Sub