Error with application.ontime method in excel vba -
i havew live data feed in excel, want record data shown here:
]
i wrote on code follows
option explicit dim schedrecalc date sub recalc() range("a1").value = format(now, "dd-mmm-yy") range("b1").value = format(time, "hh:mm:ss am/pm") call settime end sub sub settime() schedrecalc = + timevalue("00:00:01") application.ontime schedrecalc, "recalc" application.ontime schedrecalc, "record" end sub sub record() ' ' update macro ' worksheets("sheet1") application.screenupdating = false sheet1.range("a1:a169").copy _ destination:=mysheet.range("e9") sheet1.range("e9:e169").insert shift:=xlshifttoright selection.insert shift:=xltoright application.cutcopymode = false end end sub sub disable() on error resume next application.ontime earliesttime:=schedrecalc, procedure:="recalc", schedule:=false application.ontime earliesttime:=schedrecalc, procedure:="record", schedule:=false end sub
but following error coming.. have disabled security setting:
]
i ran code. make sure procedure reference using application.ontime placed module.
you may double check last line. copying , pasting code didn't make vba editor happy.
sub disable() on error resume next application.ontime earliesttime:=schedrecalc, procedure:="recalc", schedule:=false application.ontime earliesttime:=schedrecalc, procedure:="record", schedule:=false end sub
it should on 1 line.
sub disable() on error resume next application.ontime earliesttime:=schedrecalc, procedure:="recalc", schedule:=false application.ontime earliesttime:=schedrecalc, procedure:="record", schedule:=false end sub
Comments
Post a Comment