ontime

OnTime for less than 1 second without becoming Unresponsive

吃可爱长大的小学妹 提交于 2019-12-18 06:54:03
问题 I have a userform which runs a script every 100ms. The script handles images on the userform and is used to animate them, while the form continues to receive user input (mouse clicks and key presses). This continues until the userform is closed. While Application.OnTime seems to work best, it only operates consistently on time values of 1 second or more. When I use something like Sub StartTimer() Application.OnTime now + (TimeValue("00:00:01") / 10), "Timer" End Sub Private Sub Timer()

Workbook, Save, Close, Re-Open (w/ TimeValue),Repeat

五迷三道 提交于 2019-12-11 08:57:18
问题 The macro runs with a button assigned to "CloseMe". It used to run for my needs but doesn't anymore (as I tried using this code in another workbook without success). Now it saves, closes, waits 10sec to reopen, but then closes right away. Sub CloseMe() Application.OnTime Now + TimeValue("00:00:10"), "OpenMe" ThisWorkbook.Close True End Sub Sub OpenMe() Application.OnTime Now + TimeValue("00:10:00"), "OpenMe" ThisWorkbook.Close True End Sub I need the code to save, close, wait 10sec to reopen,

Application.OnTime doesn't work with userform

梦想的初衷 提交于 2019-12-08 13:15:10
问题 I've got a problem with a piece of code: Private Sub cyclic() Static i As Integer i = i + 1 Cells(i, 11) = i Open source For Append As #1 Write #1, Cells(i, 11) Close #1 Application.Wait (Now + TimeValue("0:00:01")) Open source For Input As #1 Do While Not EOF(1) Input #1, x1 Loop Cells(i, 1) = x1 Close #1 Application.OnTime Now + TimeValue("00:00:03"), "cyclic" End Sub It's pretty much like this. It works perfectly from the level of worksheets alt+f8 macros, but when I want to make use of it

VBA: How do I really stop Application.onTime()?

旧城冷巷雨未停 提交于 2019-12-01 08:29:34
[SOLVED]: Please see answers for solution. Thanks @DaveU. I have already read some questions/threads (eg this or this ) about how to stop the VBA Application.OnTime procedure, but I just can't get it to stop! I am using it to pull some data every x seconds. I understand that when I call the OnTime() method I need to pass to it the same time value that was used to schedule the event. I have also tried to introduce multiple commands (that try to cause an error for example) to stop the execution but it still doesn't work! The program just keeps running... This is how my code looks: In Worksheet

Multiple Variable Arguments to Application.OnTime

我怕爱的太早我们不能终老 提交于 2019-11-28 12:27:04
I am working on a data acquisition frontend for Excel 2010. I can't figure out the syntax for passing multiple local variable arguments to Application.OnTime . http://markrowlinson.co.uk/articles.php?id=10 provides a good example for a single variable as an argument, but the explanation on how to extrapolate this to multiple variables is not clear to me. Does anyone have a concise explanation of the correct nesting of " and ' characters when passing multiple local variable arguments? Edit: Code example would be like this: Application.OnTime Now + TimeSerial(0, 0, 5), "'runScheduledReport """ &

How to use Application.OnTime to call a macro at a set time everyday, without having to close workbook

心已入冬 提交于 2019-11-28 05:13:40
问题 I have written a macro that uses Application.OnTime that works if I manually execute the macro. I'm trying to automate this process so I don't have to write Application.OnTime in "This Workbook" or (Private Sub Workbook_Open() Most of you do this because you can have windows scheduler open the workbook at a certain time which starts the macros on open. I CANNOT USE SCHEDULER. Because I am not able to use windows scheduler I will keep the workbook open and the timer should refresh my data then

Getting around the Max String size in a vba function?

回眸只為那壹抹淺笑 提交于 2019-11-27 05:34:05
The max number of characters you can use in string in a vba function is 255. I am trying to run this function Var1= 1 Var2= 2 . . . Var256 =256 RunMacros= "'Tims_pet_Robot """ & Var1 & """ , """ & Var2 & """ , """ ... """ & Var256 """ '" Runat=TimeValue("15:00:00") Application.OnTime EarliestTime:=Runat, Procedure:=RunMacros & RunMacros2 ', schedule:=True It runs a procedure at a certain time and passes a bunch of variables to it. but the string is too long. Update: Regrettably I am sure it is not the watch window. Also, it isn't really the max size of a string that I'm dealing with. It's the

Multiple Variable Arguments to Application.OnTime

删除回忆录丶 提交于 2019-11-27 04:46:24
问题 I am working on a data acquisition frontend for Excel 2010. I can't figure out the syntax for passing multiple local variable arguments to Application.OnTime . http://markrowlinson.co.uk/articles.php?id=10 provides a good example for a single variable as an argument, but the explanation on how to extrapolate this to multiple variables is not clear to me. Does anyone have a concise explanation of the correct nesting of " and ' characters when passing multiple local variable arguments? Edit:

Getting around the Max String size in a vba function?

纵饮孤独 提交于 2019-11-26 11:37:30
问题 The max number of characters you can use in string in a vba function is 255. I am trying to run this function Var1= 1 Var2= 2 . . . Var256 =256 RunMacros= \"\'Tims_pet_Robot \"\"\" & Var1 & \"\"\" , \"\"\" & Var2 & \"\"\" , \"\"\" ... \"\"\" & Var256 \"\"\" \'\" Runat=TimeValue(\"15:00:00\") Application.OnTime EarliestTime:=Runat, Procedure:=RunMacros & RunMacros2 \', schedule:=True It runs a procedure at a certain time and passes a bunch of variables to it. but the string is too long. Update