Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rci rci is offline
external usenet poster
 
Posts: 40
Default OnTime no workie in Userform


Hi all...

the OnTime function does not work inside userform code... in the sense that
the sub that it calls can't be run in the Userform code.

The reason why I need to have it work otherwise, or to find an alternative,
is that I need to cause a button (on a userform) to become invisible after a few
seconds (while not impairing normal program funciton in the meantime).

I can cause OnTime to launch a sub in standard module code... but userform
objects are apparently invisible to code running there.

Suggestions?

Thanks all!

MP
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default OnTime no workie in Userform

You probably just need to make the procedure in the Userform that you want
Ontime to call to be public.

Public Sub ProcedureName()

End Sub

then perhaps call it with

Application.Ontime Now + Timevalue("0:0:15"), "Userform1.ProcedureName"

Where userform1 would be the name of the userform.

--
Regards,
Tom Ogilvy

"rci" wrote in message
...

Hi all...

the OnTime function does not work inside userform code... in the sense

that
the sub that it calls can't be run in the Userform code.

The reason why I need to have it work otherwise, or to find an

alternative,
is that I need to cause a button (on a userform) to become invisible after

a few
seconds (while not impairing normal program funciton in the meantime).

I can cause OnTime to launch a sub in standard module code... but userform
objects are apparently invisible to code running there.

Suggestions?

Thanks all!

MP



  #3   Report Post  
Posted to microsoft.public.excel.programming
rci rci is offline
external usenet poster
 
Posts: 40
Default OnTime no workie in Userform


Hi Tom,

thanks.... but the problem is the same... here is the code involved:


the DammitButton in inside Frame1 on the userform "S2pViewer" -



Private Sub DirListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

DammitButton.Visible = True
Application.OnTime Now + TimeValue("0:0:4"), "S2pViewer.DammitClear"

End Sub

Public Sub DammitClear()
DammitButton.Visible = False
End Sub



The error message is that the macro S2pViewer.DammitClear cannot be found.


Excel 2002


Thx,

MP





Tom Ogilvy wrote:
: You probably just need to make the procedure in the Userform that you want
: Ontime to call to be public.

: Public Sub ProcedureName()

: End Sub

: then perhaps call it with

: Application.Ontime Now + Timevalue("0:0:15"), "Userform1.ProcedureName"

: Where userform1 would be the name of the userform.

: --
: Regards,
: Tom Ogilvy

: "rci" wrote in message
: ...
:
: Hi all...
:
: the OnTime function does not work inside userform code... in the sense
: that
: the sub that it calls can't be run in the Userform code.
:
: The reason why I need to have it work otherwise, or to find an
: alternative,
: is that I need to cause a button (on a userform) to become invisible after
: a few
: seconds (while not impairing normal program funciton in the meantime).
:
: I can cause OnTime to launch a sub in standard module code... but userform
: objects are apparently invisible to code running there.
:
: Suggestions?
:
: Thanks all!
:
: MP


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default OnTime no workie in Userform

I didn't get the error you describe unless I dropped the userform before 4
seconds elapsed.

However, it didn't seem to run. If I put the Dammitclear procedure in a
general module, it ran for me.

in the S2pViewer module:

Private Sub DirListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

DammitButton.Visible = True
Application.OnTime Now + TimeValue("0:0:4"), "DammitClear"

End Sub


In a general module:

Public Sub DammitClear()
MsgBox "I ran"
S2pViewer.Frame1.DammitButton.Visible = False
End Sub

--
regards,
Tom Ogilvy

"rci" wrote in message
...

Hi Tom,

thanks.... but the problem is the same... here is the code involved:


the DammitButton in inside Frame1 on the userform "S2pViewer" -



Private Sub DirListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

DammitButton.Visible = True
Application.OnTime Now + TimeValue("0:0:4"), "S2pViewer.DammitClear"

End Sub

Public Sub DammitClear()
DammitButton.Visible = False
End Sub



The error message is that the macro S2pViewer.DammitClear cannot be found.


Excel 2002


Thx,

MP





Tom Ogilvy wrote:
: You probably just need to make the procedure in the Userform that you

want
: Ontime to call to be public.

: Public Sub ProcedureName()

: End Sub

: then perhaps call it with

: Application.Ontime Now + Timevalue("0:0:15"), "Userform1.ProcedureName"

: Where userform1 would be the name of the userform.

: --
: Regards,
: Tom Ogilvy

: "rci" wrote in message
: ...
:
: Hi all...
:
: the OnTime function does not work inside userform code... in the sense
: that
: the sub that it calls can't be run in the Userform code.
:
: The reason why I need to have it work otherwise, or to find an
: alternative,
: is that I need to cause a button (on a userform) to become invisible

after
: a few
: seconds (while not impairing normal program funciton in the meantime).
:
: I can cause OnTime to launch a sub in standard module code... but

userform
: objects are apparently invisible to code running there.
:
: Suggestions?
:
: Thanks all!
:
: MP




  #5   Report Post  
Posted to microsoft.public.excel.programming
rci rci is offline
external usenet poster
 
Posts: 40
Default OnTime no workie in Userform


Ah... this works.

Thanks again, Tom.



Tom Ogilvy wrote:
: I didn't get the error you describe unless I dropped the userform before 4
: seconds elapsed.

: However, it didn't seem to run. If I put the Dammitclear procedure in a
: general module, it ran for me.


: in the S2pViewer module:

: Private Sub DirListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

: DammitButton.Visible = True
: Application.OnTime Now + TimeValue("0:0:4"), "DammitClear"

: End Sub


: In a general module:

: Public Sub DammitClear()
: MsgBox "I ran"
: S2pViewer.Frame1.DammitButton.Visible = False
: End Sub

: --
: regards,
: Tom Ogilvy

: "rci" wrote in message
: ...
:
: Hi Tom,
:
: thanks.... but the problem is the same... here is the code involved:
:
:
: the DammitButton in inside Frame1 on the userform "S2pViewer" -
:
:
:
: Private Sub DirListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
:
: DammitButton.Visible = True
: Application.OnTime Now + TimeValue("0:0:4"), "S2pViewer.DammitClear"
:
: End Sub
:
: Public Sub DammitClear()
: DammitButton.Visible = False
: End Sub
:
:
:
: The error message is that the macro S2pViewer.DammitClear cannot be found.
:
:
: Excel 2002
:
:
: Thx,
:
: MP
:
:
:
:
:
: Tom Ogilvy wrote:
: : You probably just need to make the procedure in the Userform that you
: want
: : Ontime to call to be public.
:
: : Public Sub ProcedureName()
:
: : End Sub
:
: : then perhaps call it with
:
: : Application.Ontime Now + Timevalue("0:0:15"), "Userform1.ProcedureName"
:
: : Where userform1 would be the name of the userform.
:
: : --
: : Regards,
: : Tom Ogilvy
:
: : "rci" wrote in message
: : ...
: :
: : Hi all...
: :
: : the OnTime function does not work inside userform code... in the sense
: : that
: : the sub that it calls can't be run in the Userform code.
: :
: : The reason why I need to have it work otherwise, or to find an
: : alternative,
: : is that I need to cause a button (on a userform) to become invisible
: after
: : a few
: : seconds (while not impairing normal program funciton in the meantime).
: :
: : I can cause OnTime to launch a sub in standard module code... but
: userform
: : objects are apparently invisible to code running there.
: :
: : Suggestions?
: :
: : Thanks all!
: :
: : MP
:
:


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
Find %ontime & SUMIF ontime ie: find matching sets within Range... Chris T-M Excel Worksheet Functions 3 October 10th 08 08:14 PM
.ontime Grrrrrumpy Excel Discussion (Misc queries) 2 April 8th 07 04:18 PM
OnTime bug? Antonio Excel Discussion (Misc queries) 0 June 9th 06 08:24 PM
OnTime VB [email protected] Excel Discussion (Misc queries) 5 May 17th 06 10:53 PM
OnTime VB [email protected] Excel Worksheet Functions 2 May 16th 06 08:43 PM


All times are GMT +1. The time now is 04:52 AM.

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"