ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] PPTÀH¾÷¼½©ñ

[µo°Ý] PPTÀH¾÷¼½©ñ

½Ð°Ý¦p¦óÅý¤w°µ¦nªºPPTÀH¾÷¼½©ñ¤£¦P­¶­±ªº§ë¼v¤ù?

¥»©«³Ì«á¥Ñ ychuang ©ó 2017-7-2 02:14 ½s¿è

¸ÕµÛ¥ÎVBA¹ê§@³o­Ó¥\¯à¡C
¨ú±o§ë¼v¤ùÁ`­¶¼Æ¡A²£¥Í¤£­«ÂЪº¶Ã¼Æ±Æ§Ç¡A¦A¨Ì¦¹±Æ§Ç¥h¼½©ñ(±Æ°£­º­¶)¡C

¦ý¦p¦ó¹ê§@·s»Ý¨D¡H
¦p¦ó¦b¤¤³~«öESC©ÎCtrl+Cµ²§ô©ñ¬M?


Private Sub Image1_Click()
    Dim aRandomArray(), aTempArray() As Integer
    Dim iSlideCount As Integer, iRandomNumber As Integer, i As Integer
   
    iSlideCount = ActivePresentation.Slides.Count                    'Get count of slides
    ReDim aTempArray(iSlideCount), aRandomArray(0 To iSlideCount, 1 To 1) 'Redeclare array size
   
    'Initialize Temp Array 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) 'Pass first title slide
        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

TOP

§¹¦¨¤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

TOP

        ÀR«ä¦Û¦b : ¤H­nª¾ºÖ¡B±¤ºÖ¡B¦A³yºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD