PC Review


Reply
Thread Tools Rate Thread

OnTime Method fails when Form displayed???

 
 
Ken Soenen
Guest
Posts: n/a
 
      8th Dec 2005
Why doen't the OnTime Method work after a Form is displayed?
Using XP and Excel 2003

any ideas?
thanks

1. go to Forms Module and Run then click button: it does NOTwork. The
msgbox is not displayed.
2. go to module1 and Run sub works(). Everything works as expected.

Put this code in the Forms Module and put a commandbutton on a form
**************************
Private Sub CommandButton1_Click()
'call sub doesNotWork after 3 seconds
Application.OnTime (Now() + TimeSerial(0, 0, 3)), "doesNotWork"

End Sub

Put this code in Module1
*******************
Sub works()
'call sub worksOK after 3 seconds
Application.OnTime (Now() + TimeSerial(0, 0, 3)), "worksOK"
End Sub

Sub worksOK()
MsgBox "worksOK"
End Sub

Sub doesNotWork()
MsgBox "doesNotWork"
End Sub


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      8th Dec 2005
Works for me.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ken Soenen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Why doen't the OnTime Method work after a Form is displayed?
> Using XP and Excel 2003
>
> any ideas?
> thanks
>
> 1. go to Forms Module and Run then click button: it does NOTwork. The
> msgbox is not displayed.
> 2. go to module1 and Run sub works(). Everything works as expected.
>
> Put this code in the Forms Module and put a commandbutton on a form
> **************************
> Private Sub CommandButton1_Click()
> 'call sub doesNotWork after 3 seconds
> Application.OnTime (Now() + TimeSerial(0, 0, 3)), "doesNotWork"
>
> End Sub
>
> Put this code in Module1
> *******************
> Sub works()
> 'call sub worksOK after 3 seconds
> Application.OnTime (Now() + TimeSerial(0, 0, 3)), "worksOK"
> End Sub
>
> Sub worksOK()
> MsgBox "worksOK"
> End Sub
>
> Sub doesNotWork()
> MsgBox "doesNotWork"
> End Sub
>
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      8th Dec 2005
It worked fine for me (also using xl2003 and winXP (home)).



Ken Soenen wrote:
>
> Why doen't the OnTime Method work after a Form is displayed?
> Using XP and Excel 2003
>
> any ideas?
> thanks
>
> 1. go to Forms Module and Run then click button: it does NOTwork. The
> msgbox is not displayed.
> 2. go to module1 and Run sub works(). Everything works as expected.
>
> Put this code in the Forms Module and put a commandbutton on a form
> **************************
> Private Sub CommandButton1_Click()
> 'call sub doesNotWork after 3 seconds
> Application.OnTime (Now() + TimeSerial(0, 0, 3)), "doesNotWork"
>
> End Sub
>
> Put this code in Module1
> *******************
> Sub works()
> 'call sub worksOK after 3 seconds
> Application.OnTime (Now() + TimeSerial(0, 0, 3)), "worksOK"
> End Sub
>
> Sub worksOK()
> MsgBox "worksOK"
> End Sub
>
> Sub doesNotWork()
> MsgBox "doesNotWork"
> End Sub


--

Dave Peterson
 
Reply With Quote
 
Ken Soenen
Guest
Posts: n/a
 
      8th Dec 2005
Sorry guys. After turning my machine back on again this afternoon, it works
now for me also on Excel.
However, it still fails on WORD 2003 with XP and WORD 2000 SR-1 with ME. I'm
writing the application to run on both WORD and Excel. Could have sworn I
tested it several times on Excel. Maybe not. With my memory, I consider
myself lucky to find my car in the parking lot nowadays!

Dave and Bob ; Thanks for your time
ken

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It worked fine for me (also using xl2003 and winXP (home)).
>
>
>
> Ken Soenen wrote:
>>
>> Why doen't the OnTime Method work after a Form is displayed?
>> Using XP and Excel 2003
>>
>> any ideas?
>> thanks
>>
>> 1. go to Forms Module and Run then click button: it does NOTwork. The
>> msgbox is not displayed.
>> 2. go to module1 and Run sub works(). Everything works as expected.
>>
>> Put this code in the Forms Module and put a commandbutton on a form
>> **************************
>> Private Sub CommandButton1_Click()
>> 'call sub doesNotWork after 3 seconds
>> Application.OnTime (Now() + TimeSerial(0, 0, 3)), "doesNotWork"
>>
>> End Sub
>>
>> Put this code in Module1
>> *******************
>> Sub works()
>> 'call sub worksOK after 3 seconds
>> Application.OnTime (Now() + TimeSerial(0, 0, 3)), "worksOK"
>> End Sub
>>
>> Sub worksOK()
>> MsgBox "worksOK"
>> End Sub
>>
>> Sub doesNotWork()
>> MsgBox "doesNotWork"
>> End Sub

>
> --
>
> Dave Peterson



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnTime method =?Utf-8?B?eGxjaGFybGll?= Microsoft Excel Programming 1 11th Feb 2005 05:20 PM
ontime method? =?Utf-8?B?bWF4?= Microsoft Excel Programming 2 7th Feb 2005 04:25 PM
ontime Method Bill Krone Microsoft Excel Programming 1 12th Aug 2004 05:30 PM
OnTime Method Ronald Dodge Microsoft Access VBA Modules 9 20th Oct 2003 11:02 PM
Help me with OnTime Method dolegow Microsoft Excel Programming 1 12th Oct 2003 02:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:37 AM.