kunguito
07-12-2007, 06:59 AM
I am trying to do something that may look peculiar. The purpose of my little program is to learn vocabulary, combining a picture and a text that is prompted some seconds after the image and that represents it.
In Powerpoint (Yes I'm aware that there's a section for that),
I want to run a SlideShow and then without any control or form on the slides, depending on the key pressed Y/N.
(Yes:I know this word so there is no need to display it any more)
(No: Ohh, **** I don't remember it)
And then propmt a random slide.
Well my problem is that I don't think Powerpoint allows me to generate some kind of Key_Down event. This is what I tried:
Go directly to DataEntered_KeyDown(), when I run it says that the type hasn't been defined by the user.
Private numSlides As Integer
Private NewId As Long
Private qSlides() As Long 'Dynamically created
'This is the main program
Public Sub RandomSlideShow()
Call IdentifierSlides
'Establish the options for the SlideShow
With ActivePresentation.SlideShowSettings
.AdvanceMode = ppSlideShowManualAdvance
.LoopUntilStopped = msoTrue
.Run 'Start SlideShow
End With
End Sub
Public Sub DataEntered_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyY Then
'delete the slideID from the array
Call DeleteSlideIndex(qSlides(), NewId)
ElseIf KeyCode = vbKeyN Then
'Nothing
ElseIf KeyCode = vbKeyESC Then
'Abort the presentation
Else
End If
'generate a random ID from the array
NewId = GenerateNewID
'Go to new slide
With SlideShowWindows(1).View
.GotoSlide NewId, msoFalse
End With
End Sub
Private Sub DeleteSlideIndex(MyArray() As Long, Index As Integer)
Dim I As Integer
For I = Index To UBound(MyArray) - 1
MyArray(I) = MyArray(I + 1)
Next I
ReDim Preserve MyArray(UBound(MyArray) - 1)
End Sub
Private Sub IdentifierSlides()
numSlides = ActivePresentation.Slides.Count 'Counts the number of Slides of the presentation
ReDim qSlides(1 To numSlides) As Long
'Store the index of every slide in qSlides
For I = 1 To numSlides
qSlides(I) = ActivePresentation.Slides.Item(I).SlideID
Next
End Sub
Public Function GenerateNewID(MyArray() As Long)
Dim num As Integer
'Changes the seed of the randomization
Randomize
num = Int((UBound(MyArray) - LBound(MyArray) + 1) * Rnd + LBound(MyArray))
GenerateNewID = MyArray(num)
End Function
I start to be annoyed by powerpoint, so maybe it's better I try it on Flash, what do you think? Any other suggestion
In Powerpoint (Yes I'm aware that there's a section for that),
I want to run a SlideShow and then without any control or form on the slides, depending on the key pressed Y/N.
(Yes:I know this word so there is no need to display it any more)
(No: Ohh, **** I don't remember it)
And then propmt a random slide.
Well my problem is that I don't think Powerpoint allows me to generate some kind of Key_Down event. This is what I tried:
Go directly to DataEntered_KeyDown(), when I run it says that the type hasn't been defined by the user.
Private numSlides As Integer
Private NewId As Long
Private qSlides() As Long 'Dynamically created
'This is the main program
Public Sub RandomSlideShow()
Call IdentifierSlides
'Establish the options for the SlideShow
With ActivePresentation.SlideShowSettings
.AdvanceMode = ppSlideShowManualAdvance
.LoopUntilStopped = msoTrue
.Run 'Start SlideShow
End With
End Sub
Public Sub DataEntered_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyY Then
'delete the slideID from the array
Call DeleteSlideIndex(qSlides(), NewId)
ElseIf KeyCode = vbKeyN Then
'Nothing
ElseIf KeyCode = vbKeyESC Then
'Abort the presentation
Else
End If
'generate a random ID from the array
NewId = GenerateNewID
'Go to new slide
With SlideShowWindows(1).View
.GotoSlide NewId, msoFalse
End With
End Sub
Private Sub DeleteSlideIndex(MyArray() As Long, Index As Integer)
Dim I As Integer
For I = Index To UBound(MyArray) - 1
MyArray(I) = MyArray(I + 1)
Next I
ReDim Preserve MyArray(UBound(MyArray) - 1)
End Sub
Private Sub IdentifierSlides()
numSlides = ActivePresentation.Slides.Count 'Counts the number of Slides of the presentation
ReDim qSlides(1 To numSlides) As Long
'Store the index of every slide in qSlides
For I = 1 To numSlides
qSlides(I) = ActivePresentation.Slides.Item(I).SlideID
Next
End Sub
Public Function GenerateNewID(MyArray() As Long)
Dim num As Integer
'Changes the seed of the randomization
Randomize
num = Int((UBound(MyArray) - LBound(MyArray) + 1) * Rnd + LBound(MyArray))
GenerateNewID = MyArray(num)
End Function
I start to be annoyed by powerpoint, so maybe it's better I try it on Flash, what do you think? Any other suggestion