Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find %ontime & SUMIF ontime ie: find matching sets within Range... | Excel Worksheet Functions | |||
.ontime | Excel Discussion (Misc queries) | |||
OnTime bug? | Excel Discussion (Misc queries) | |||
OnTime VB | Excel Discussion (Misc queries) | |||
OnTime VB | Excel Worksheet Functions |