|
2011年2月16日
昨天娃娃爸爸给娃娃编了一个宏,放入ppt中,可以让幻灯片随机放映,给妈妈节省不少工作量,先把宏贴在这里,有需要的可以自己放入ppt中,如果不会的可以等我做出来ppt再上传
Option Explicit
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
随即点名double,以2张为单位循环,适用于百科卡(一张字一张图的那种)
Dim Savetime As Double
Dim Arr As Variant
Arr = Array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11) '修改循环胶片
Dim stoptime As Integer
stoptime = 700 '修改播放速度
Randomize
Dim tmp
Dim tmp_index As Integer
Dim Lb As Integer, Ub As Integer
Lb = LBound(Arr)
Ub = UBound(Arr)
Dim i As Integer
For i = Lb To Ub
If ((i Mod 2) = 0) Then
tmp_index = Int((Ub - Lb + 1) * Rnd + Lb)
If ((tmp_index Mod 2) = 1) Then tmp_index = tmp_index - 1
tmp = Arr(i)
Arr(i) = Arr(tmp_index)
Arr(tmp_index) = tmp
tmp = Arr(i + 1)
Arr(i + 1) = Arr(tmp_index + 1)
Arr(tmp_index + 1) = tmp
End If
Next
For i = Lb To Ub
SlideShowWindows(1).View.GotoSlide Arr(i)
Savetime = timeGetTime
While timeGetTime < Savetime + stoptime
DoEvents
Wend
Next
SlideShowWindows(1).View.GotoSlide 32
随即点名-single,单张循环的,适用于字ka
Dim Savetime As Double
Dim Arr As Variant
Arr = Array(2, 3, 4, 5, 6) '修改循环胶片
Dim stoptime As Integer
stoptime = 700 '修改播放速度
Randomize
Dim tmp
Dim tmp_index As Integer
Dim Lb As Integer, Ub As Integer
Lb = LBound(Arr)
Ub = UBound(Arr)
Dim i As Integer
For i = Lb To Ub
tmp_index = Int((Ub - Lb + 1) * Rnd + Lb)
tmp = Arr(i)
Arr(i) = Arr(tmp_index)
Arr(tmp_index) = tmp
Next
For i = Lb To Ub
SlideShowWindows(1).View.GotoSlide Arr(i)
Savetime = timeGetTime
While timeGetTime < Savetime + stoptime
DoEvents
Wend
Next
SlideShowWindows(1).View.GotoSlide 1 |
|