ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help Using Click Event (https://www.excelbanter.com/excel-programming/316517-help-using-click-event.html)

dnj

Help Using Click Event
 

I am working on a science fair project and am trying to build a progra
using Excel 97 to measure reaction time. The program opens
powerpoint file and begins showing slides. When certain slide
come-up, a timer starts to measure how long it takes a person t
recognize the slide and either click the mouse or hit a key. I'v
gotten everything to work except how to use the mouse click or key t
stop the timer. I think Click event is what I need but I do not kno
how to use it. The following is what I have so far. Any help would b
greatly appreciated.

Sub RunPowerPoint()
Dim filepath As String
Dim NumSlides, Slides As Integer

filepath = Worksheets("PowerPointFiles").Range("B1").Value
NumSlides = Worksheets("PowerPointFiles").Range("B2").Value
Slides = 0 'Initialize

'Shell to open PowerPoint
returnvalue = Shell("C:\Program Files\Microsof
Office\Office\POWERPNT.EXE", 1)
'Open File on desk top
SendKeys "%o", True
SendKeys "{enter}", True
SendKeys filepath, True
SendKeys "{enter}", True
'Open Slide Show
SendKeys "%f", True
SendKeys "{right 2}", True
SendKeys "{down 4}", True
SendKeys "{enter}", True
'Show Slides
Do
If Slides = NumSlides Then Exit Do
PauseTime = 6 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
SendKeys "{right}", True
Slides = Slides + 1
Loop
'Close Power Point
AppActive = returnvalue
SendKeys "{esc}", True
SendKeys "%f", True
SendKeys "x", True
End Su

--
dn
-----------------------------------------------------------------------
dnj's Profile: http://www.excelforum.com/member.php...fo&userid=1636
View this thread: http://www.excelforum.com/showthread.php?threadid=27751



All times are GMT +1. The time now is 01:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com