ontime

Application.OnTime running when it shouldn't

℡╲_俬逩灬. 提交于 2021-02-04 06:38:29
问题 I've written a script which generates a Lotus Notes email to publish data at certain time intervals. This script is Macro2 - Macro5. Macro 2 - Macro 5 are all identical, but I've duplicated the script under different subs to try and diagnose my problem. The problem that I am experiencing is sometimes at for instance 8pm, 4 emails will be generated. One email will be triggered correctly by Macro 5, but the other emails sent at 8pm have been triggered by Macro 2. I know this because I've added

Application.OnTime running when it shouldn't

佐手、 提交于 2021-02-04 06:35:02
问题 I've written a script which generates a Lotus Notes email to publish data at certain time intervals. This script is Macro2 - Macro5. Macro 2 - Macro 5 are all identical, but I've duplicated the script under different subs to try and diagnose my problem. The problem that I am experiencing is sometimes at for instance 8pm, 4 emails will be generated. One email will be triggered correctly by Macro 5, but the other emails sent at 8pm have been triggered by Macro 2. I know this because I've added

application.ontime not cancelling or running in background

蹲街弑〆低调 提交于 2021-01-28 01:34:10
问题 I'm using the Application.Ontime command to automatically close a spreadsheet after a period of inactivity (10 minutes). The following code seems to work in general, however, it appears that if you manually close the sheet yourself, the workbook still seems to be active in the background and at the last designated 'endtime' will open itself so that it can close itself. This is also evident in the VBA code window as after the CloseWB macro runs and the excel workbook appears to be closed, it

VBA ontime cancel scheduling

大兔子大兔子 提交于 2021-01-20 07:09:25
问题 I have written a macro that runs at 15:30pm every workday when a workbook is first opened. When the workbook is closed it tries to open itself the next time the macro is scheduled to run. I have tried to turn the scheduler to false and am getting an error. Code below. Has anyone any ideas why this isn't working? Private Sub Workbook_Open() Application.OnTime TimeValue("15:30:00"), "MacroTimeTest" End Sub public dtime as date Sub MacroTimeTest() dtime = (Format(Application.Evaluate("workday

VBA ontime cancel scheduling

五迷三道 提交于 2021-01-20 07:04:25
问题 I have written a macro that runs at 15:30pm every workday when a workbook is first opened. When the workbook is closed it tries to open itself the next time the macro is scheduled to run. I have tried to turn the scheduler to false and am getting an error. Code below. Has anyone any ideas why this isn't working? Private Sub Workbook_Open() Application.OnTime TimeValue("15:30:00"), "MacroTimeTest" End Sub public dtime as date Sub MacroTimeTest() dtime = (Format(Application.Evaluate("workday

VBA ontime cancel scheduling

时光毁灭记忆、已成空白 提交于 2021-01-20 07:03:28
问题 I have written a macro that runs at 15:30pm every workday when a workbook is first opened. When the workbook is closed it tries to open itself the next time the macro is scheduled to run. I have tried to turn the scheduler to false and am getting an error. Code below. Has anyone any ideas why this isn't working? Private Sub Workbook_Open() Application.OnTime TimeValue("15:30:00"), "MacroTimeTest" End Sub public dtime as date Sub MacroTimeTest() dtime = (Format(Application.Evaluate("workday

Cannot run the macro

久未见 提交于 2020-03-03 05:36:01
问题 I have encountered a problem in the macro below Sub RefreshAction() Range("b7").Select Application.Run "RefreshCurrentSelection" Application.OnTime (Now() + TimeValue("00:00:05")), "thisworkbook.Action" End Sub The cell refreshes when I run the macro the first time but I get the error message immediately after Message: Cannot run the macro "C\Desktop\XYZ.xlsm'!thisworkbook.Action'. The macro may not be available in this workbook or all macros may be disabled. I have already gone through

OnTime TimeStamp Value Doubling Up

懵懂的女人 提交于 2019-12-24 19:33:16
问题 When you launch RecordData() sub (from OpenMe() sub) just once it works perfectly. Each time stamp log is consecutive with no doubles. Its when the workbook, re-opens again (due to OpenMe()/Close() subs) is when it creates a duplicate time stamp log. Can I re-arrange the OnTime so it doesn't schedule a double for its next session? Or separate the two OnTime's somehow so their independent? Dim NextTime As Double Sub RecordData() Dim Interval As Double Dim cel As Range, Capture As Range

How can I check for or cancel MULTIPLE pending application.ontime events in excel VBA?

瘦欲@ 提交于 2019-12-19 16:35:37
问题 I'm using the Application.Ontime event to pull a time field from a cell, and schedule a subroutine to run at that time. My Application.Ontime event runs on the Workbook_BeforeSave event. As such, if a user (changes the desired time + saves the workbook) multiple times, multiple Application.Ontime events are created. Theoretically I could keep track of each event with a unique time variable.. but is there a way to check/parse/cancel pending events? Private Sub Workbook_BeforeSave SendTime =

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

断了今生、忘了曾经 提交于 2019-12-19 09:27:28
问题 [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