Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The following code gives me the error "macro The_Sub cannot be found". What is wrong? The code is enterend in the Workbook module and the ontime does execute 10 seconds after I open the workbook. That is when I get the error. Public RunWhen As Double Public RunWhat As String Public myOffset As Double Sub Workbook_Open() myOffset = 0 StartTimer End Sub Sub Workbook_Close() StopTimer End Sub Sub StartTimer() RunWhen = Now + TimeSerial(0, 0, 10) RunWhat = "The_Sub" Application.OnTime earliesttime:=RunWhen, procedu=RunWhat, schedule:=True End Sub Sub The_Sub() Range("A4").Offset(0, myOffset) = myOffset myOffset = myOffset + 1 StartTimer End Sub Sub StopTimer() On Error Resume Next Application.OnTime ealiesttime:=RunWhen, procedu=RunWhat, schedule:=False End Sub -- gmferg1 ------------------------------------------------------------------------ gmferg1's Profile: http://www.excelforum.com/member.php...o&userid=34191 View this thread: http://www.excelforum.com/showthread...hreadid=553061 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should all be in A general module (insert=Module in the VBE)
Public RunWhen As Double Public RunWhat As String Public myOffset As Double Sub StartTimer() RunWhen = Now + TimeSerial(0, 0, 10) RunWhat = "The_Sub" Application.OnTime earliesttime:=RunWhen, procedu=RunWhat, schedule:=True End Sub Sub The_Sub() Range("A4").Offset(0, myOffset) = myOffset myOffset = myOffset + 1 StartTimer End Sub Sub StopTimer() On Error Resume Next Application.OnTime ealiesttime:=RunWhen, procedu=RunWhat, schedule:=False End Sub ------------- This should be in the ThisWorkbook module: Sub Workbook_Open() myOffset = 0 StartTimer End Sub Sub Workbook_Close() StopTimer End Sub -- Regards, Tom Ogilvy "gmferg1" wrote in message ... The following code gives me the error "macro The_Sub cannot be found". What is wrong? The code is enterend in the Workbook module and the ontime does execute 10 seconds after I open the workbook. That is when I get the error. Public RunWhen As Double Public RunWhat As String Public myOffset As Double Sub Workbook_Open() myOffset = 0 StartTimer End Sub Sub Workbook_Close() StopTimer End Sub Sub StartTimer() RunWhen = Now + TimeSerial(0, 0, 10) RunWhat = "The_Sub" Application.OnTime earliesttime:=RunWhen, procedu=RunWhat, schedule:=True End Sub Sub The_Sub() Range("A4").Offset(0, myOffset) = myOffset myOffset = myOffset + 1 StartTimer End Sub Sub StopTimer() On Error Resume Next Application.OnTime ealiesttime:=RunWhen, procedu=RunWhat, schedule:=False End Sub -- gmferg1 ------------------------------------------------------------------------ gmferg1's Profile: http://www.excelforum.com/member.php...o&userid=34191 View this thread: http://www.excelforum.com/showthread...hreadid=553061 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That works now. Thanks. -- gmferg1 ------------------------------------------------------------------------ gmferg1's Profile: http://www.excelforum.com/member.php...o&userid=34191 View this thread: http://www.excelforum.com/showthread...hreadid=553061 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find %ontime & SUMIF ontime ie: find matching sets within Range... | Excel Worksheet Functions | |||
.ontime | Excel Discussion (Misc queries) | |||
OnTime VB | Excel Discussion (Misc queries) | |||
Error using OnTime Method | Excel Programming | |||
about ontime | Excel Programming |