Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using application.ontime J.W. Aldridge Excel Programming 1 October 26th 07 10:38 PM
Help with Application.OnTime [email protected] Excel Programming 1 April 3rd 06 06:02 PM
application.ontime rick Excel Programming 2 July 25th 05 06:09 PM
Application.OnTIme Mike Excel Programming 8 September 15th 04 03:27 PM
Application.OnTime and Visual C++ cdupain Excel Programming 0 November 12th 03 10:11 AM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"