Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.OnTime stopped working
Strangely some code I wrote using Application.OnTime stopped working. I
added the Windows Media Player to my library just prior to the failure, but not until it ran successfully a few time. I am using really simple code so it seems like it should work, but I have provided it below: Sub TryIt() Dim MyStart As Long Dim RunWhen As Long RunWhen = Now + TimeSerial(0, 0, 5) ' close 5 seconds from now MyStart = 200 'This seems to be in seconds Application.EnableEvents = True Load UserForm1 UserForm1.Caption = "My File : MyStart - MyFinish" UserForm1.WindowsMediaPlayer1.settings.autoStart = False UserForm1.WindowsMediaPlayer1.URL = "C:\myfile.mpg" UserForm1.WindowsMediaPlayer1.Controls.currentPosi tion = MyStart 'Jumps to start location UserForm1.WindowsMediaPlayer1.Controls.Play Application.OnTime RunWhen, "EndVideo" UserForm1.Show End Sub Sub EndVideo() UserForm1.WindowsMediaPlayer1.Controls.stop UserForm1.WindowsMediaPlayer1.Controls.currentPosi tion = 200 End Sub Any help would be appreciated. Note that nearly a piece of code using Application.OnTime in another workbook works fine. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.OnTime stopped working
I am changing my story. Application.OnTime does work when in the workbook,
but only when the Windows Media Player on the UserForm is not involved. When the Windows Media Player is involved, there is no delay in running the next routine. Basically, the question is how do I get the delay to work with running a video on a UserForm. Thanks. "ZipCurs" wrote: Strangely some code I wrote using Application.OnTime stopped working. I added the Windows Media Player to my library just prior to the failure, but not until it ran successfully a few time. I am using really simple code so it seems like it should work, but I have provided it below: Sub TryIt() Dim MyStart As Long Dim RunWhen As Long RunWhen = Now + TimeSerial(0, 0, 5) ' close 5 seconds from now MyStart = 200 'This seems to be in seconds Application.EnableEvents = True Load UserForm1 UserForm1.Caption = "My File : MyStart - MyFinish" UserForm1.WindowsMediaPlayer1.settings.autoStart = False UserForm1.WindowsMediaPlayer1.URL = "C:\myfile.mpg" UserForm1.WindowsMediaPlayer1.Controls.currentPosi tion = MyStart 'Jumps to start location UserForm1.WindowsMediaPlayer1.Controls.Play Application.OnTime RunWhen, "EndVideo" UserForm1.Show End Sub Sub EndVideo() UserForm1.WindowsMediaPlayer1.Controls.stop UserForm1.WindowsMediaPlayer1.Controls.currentPosi tion = 200 End Sub Any help would be appreciated. Note that nearly a piece of code using Application.OnTime in another workbook works fine. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using application.ontime | Excel Programming | |||
Help with Application.OnTime | Excel Programming | |||
application.ontime | Excel Programming | |||
Application.OnTIme | Excel Programming | |||
Application.OnTime and Visual C++ | Excel Programming |