我是一名教师,我用powerpoint编写点击式游戏。我有一个有3个按钮的幻灯片和2个变量(var1和var2)的代码,按钮3是退出(退出)按钮,只有当var1 = 1和var2 = 1按钮必须按正确的顺序才能退出(按钮1紧跟按钮2)我已经在模块的顶部声明了变量为整数。我的代码如下...
sub button1()
var1 = 1
var2 = 0
end sub
sub button2()
var2 = 1
end sub
sub button exit()
If var1.Value = 1 & var2.Value = 1 Then
With SlideShowWindows(1).View
.GotoSlide 58, msoFalse
End With
Else
MsgBox ("incorrect combination")
End If
end sub我不是专家,也搞不懂为什么这个方法行不通。有什么需要帮忙的吗?
发布于 2013-01-31 01:07:48
这应该是可行的。如果没有,请让我们知道哪里出了问题:
Option Explicit
' Always start with this; it forces you to
' declare your variables properly
Dim var1 as integer
Dim var2 as integer
sub button1()
var1 = 1
var2 = 0
end sub
sub button2()
var2 = 1
end sub
sub button exit()
If var1 + var2 = 2 Then
With SlideShowWindows(1).View
.GotoSlide 58, msoFalse
End With
Else
MsgBox ("incorrect combination")
End If
end subhttps://stackoverflow.com/questions/14591180
复制相似问题