- ©«¤l
- 8
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 2013
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-6-6
- ³Ì«áµn¿ý
- 2018-8-27
|
§¹¦¨¤F¡A¥\¯à¦p¤U:
1. ¦Û°Ê¼½©ñPPT·|°±¯d¦bº¶
2. ·í«ö¤U Image ª«¥ó«á¡A¶}©lÀH¾÷¼½©ñ¤£«Âж±ªº§ë¼v¤ù
(¼½©ñ¶¡¹j 2 ¬í)
3. «ö ESC ©Î Ctrl+C §Y¥iµ²§ô¼½©ñ¡C
(¾A¥Î©ó 32-bit ©M 64-bit ªº¨t²Î)
#If VBA7 And Win64 Then
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare PtrSafe Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
#Else
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
#End If
Private Sub Image1_Click()
Dim aRandomArray(), aTempArray() As Integer
Dim iSlideCount As Integer, iRandomNumber As Integer, i As Integer
Dim iKey As Integer
iSlideCount = ActivePresentation.Slides.Count 'Get count of slides
ReDim aTempArray(iSlideCount), aRandomArray(0 To iSlideCount, 1 To 1) 'Redeclare array size
'Initialize aTempArray with count-up integer
For i = 0 To iSlideCount - 1
aTempArray(i) = i
Next i
'Generate random number based on iSlideCount
Randomize (Timer)
For i = iSlideCount - 1 To 0 Step -1
iRandomNumber = Int(i * Rnd)
aRandomArray(iSlideCount - i, 1) = aTempArray(iRandomNumber) + 1
If aRandomArray(iSlideCount - i, 1) > 1 Then SlideShowWindows(1).View.GotoSlide aRandomArray(iSlideCount - i, 1) 'Bypass first title slide
'Press [ESC] key or combined [Ctrl+C] keys to cancel the presentation
If GetAsyncKeyState(vbKeyEscape) Or (GetAsyncKeyState(vbKeyControl) & GetAsyncKeyState(vbKeyC)) Then Exit For
Sleep( 2 * 1000) 'Delay 2 seconds
aTempArray(iRandomNumber) = aTempArray(i)
Next i
SlideShowWindows(1).View.GotoSlide 1 'Return to first slide
SlideShowWindows(Index:=1).View.Exit 'End of presentation
End Sub |
|