|
下面代码中首先申明了一个常量Const k As Integer = 20,
后面模块中引用常量k没有问题,我想让k值等于当前幻灯片放映页面编号,
修改成Const k As Integer = ActiveWindow.Selection.SlideRange.SlideIndex
就没有效果了,请老师们看看如何修改。
Const k As Integer = ActiveWindow.Selection.SlideRange.SlideIndex
代码如下:
’Const k As Integer = 20
Const k As Integer = ActiveWindow.Selection.SlideRange.SlideIndex
Sub 甲1a()
ActivePresentation.Slides(k).Shapes("答甲1").TextEffect.Text = Mid(ActivePresentation.Slides(k).Shapes("甲1a").TextEffect.Text, 1, 1)
End Sub
Sub 甲1b()
ActivePresentation.Slides(k).Shapes("答甲1").TextEffect.Text = Mid(ActivePresentation.Slides(k).Shapes("甲1b").TextEffect.Text, 1, 1)
End Sub
Sub 甲1c()
ActivePresentation.Slides(k).Shapes("答甲1").TextEffect.Text = Mid(ActivePresentation.Slides(k).Shapes("甲1c").TextEffect.Text, 1, 1)
End Sub
Sub 甲2a()
ActivePresentation.Slides(k).Shapes("答甲2").TextEffect.Text = Mid(ActivePresentation.Slides(k).Shapes("甲2a").TextEffect.Text, 1, 1)
End Sub
Sub 甲2b()
ActivePresentation.Slides(k).Shapes("答甲2").TextEffect.Text = Mid(ActivePresentation.Slides(k).Shapes("甲2b").TextEffect.Text, 1, 1)
End Sub
'提交
Sub 甲提交()
Dim 分数甲 As Long
If ActivePresentation.Slides(k).Shapes("答甲1").TextEffect.Text = "B" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲2").TextEffect.Text = "C" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲3").TextEffect.Text = "C" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲4").TextEffect.Text = "C" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲5").TextEffect.Text = "B" Then
分数甲 = 分数甲 + 20
End If
ActivePresentation.Slides(k).Shapes("甲得分").TextEffect.Text = "恭喜你此次挑战获得:" & 分数甲 & "分"
End Sub
'重做
Sub 甲重做()
ActivePresentation.Slides(k).Shapes("甲题目1").Left = 0.46 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目1").Top = -11.68 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目2").Left = 0.46 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目2").Top = -11.68 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目3").Left = 0.46 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目3").Top = -11.68 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目4").Left = 0.46 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目4").Top = -11.68 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目5").Left = 0.46 * 28.35
ActivePresentation.Slides(k).Shapes("甲题目5").Top = -11.68 * 28.35
ActivePresentation.Slides(k).Shapes("答甲1").TextEffect.Text = ""
ActivePresentation.Slides(k).Shapes("答甲2").TextEffect.Text = ""
ActivePresentation.Slides(k).Shapes("答甲3").TextEffect.Text = ""
ActivePresentation.Slides(k).Shapes("答甲4").TextEffect.Text = ""
ActivePresentation.Slides(k).Shapes("答甲5").TextEffect.Text = ""
ActivePresentation.Slides(k).Shapes("甲得分").TextEffect.Text = "恭喜你此次挑战获得:"
End Sub
Sub 开始()
ActivePresentation.Slides(k).Shapes("甲题目1").Top = ActivePresentation.Slides(k).Shapes("甲题目1").Top + 400
ActivePresentation.Slides(k).Shapes("甲当前题").TextEffect.Text = 1
ActivePresentation.Slides(k).Shapes("乙题目1").Top = ActivePresentation.Slides(k).Shapes("乙题目1").Top + 400
ActivePresentation.Slides(k).Shapes("乙当前题").TextEffect.Text = 1
For m = 120 To 0 Step -1
ActivePresentation.Slides(k).Shapes("剩时").TextEffect.Text = m
d = Timer
暂停时间 = 1
Do While Timer - d < 暂停时间
DoEvents
Loop
Next m
If ActivePresentation.Slides(k).Shapes("剩时").TextEffect.Text = 0 Then
Dim 分数甲 As Long
Dim 分数乙 As Long
If ActivePresentation.Slides(k).Shapes("答甲1").TextEffect.Text = "B" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲2").TextEffect.Text = "C" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲3").TextEffect.Text = "C" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲4").TextEffect.Text = "C" Then
分数甲 = 分数甲 + 20
End If
If ActivePresentation.Slides(k).Shapes("答甲5").TextEffect.Text = "B" Then
分数甲 = 分数甲 + 20
End If
ActivePresentation.Slides(k).Shapes("甲得分").TextEffect.Text = "恭喜你此次挑战获得:" & 分数甲 & "分"
End If
If ActivePresentation.Slides(k).Shapes("答乙1").TextEffect.Text = "B" Then
分数乙 = 分数乙 + 20
End If
If ActivePresentation.Slides(k).Shapes("答乙2").TextEffect.Text = "C" Then
分数乙 = 分数乙 + 20
End If
If ActivePresentation.Slides(k).Shapes("答乙3").TextEffect.Text = "C" Then
分数乙 = 分数乙 + 20
End If
If ActivePresentation.Slides(k).Shapes("答乙4").TextEffect.Text = "C" Then
分数乙 = 分数乙 + 20
End If
If ActivePresentation.Slides(k).Shapes("答乙5").TextEffect.Text = "B" Then
分数乙 = 分数乙 + 20
End If
ActivePresentation.Slides(k).Shapes("乙得分").TextEffect.Text = "恭喜你此次挑战获得:" & 分数乙 & "分"
End Sub
Sub 甲下一题()
Dim i As Long
If CInt(ActivePresentation.Slides(k).Shapes("甲当前题").TextEffect.Text) = 5 Then
MsgBox "已经是最后1题了"
Exit Sub
End If
i = CInt(ActivePresentation.Slides(k).Shapes("甲当前题").TextEffect.Text) + 1
ActivePresentation.Slides(k).Shapes("甲题目" & i).Top = ActivePresentation.Slides(k).Shapes("甲题目" & i).Top + 400
ActivePresentation.Slides(k).Shapes("甲题目" & i - 1).Top = ActivePresentation.Slides(k).Shapes("甲题目" & i - 1).Top - 400
ActivePresentation.Slides(k).Shapes("甲当前题").TextEffect.Text = i
End Sub
Sub 乙下一题()
Dim j As Long
If CInt(ActivePresentation.Slides(k).Shapes("乙当前题").TextEffect.Text) = 5 Then
MsgBox "已经是最后1题了"
Exit Sub
End If
j = CInt(ActivePresentation.Slides(k).Shapes("乙当前题").TextEffect.Text) + 1
ActivePresentation.Slides(k).Shapes("乙题目" & j).Top = ActivePresentation.Slides(k).Shapes("乙题目" & j).Top + 400
ActivePresentation.Slides(k).Shapes("乙题目" & j - 1).Top = ActivePresentation.Slides(k).Shapes("乙题目" & j - 1).Top - 400
ActivePresentation.Slides(k).Shapes("乙当前题").TextEffect.Text = j
End Sub
|
|