daveatthewell
New Member
- Joined
- Jul 28, 2006
- Messages
- 43
Here's what I'd like to achieve:
I have subroutine which takes one or more parameters - one being the same time that an ontime event triggers eg
sub mysub(active as date, lRow as long)
code
end sub
I need the ontime event to run the subroutine say 10 times a day at hourly intervals, each time checking the time until a certain time has been reached, then not call it again until the same start time every day. because I want to run effectively, the same routine every hour, it would be good if I could call one routine and pass parameters to it including the time it runs and and integer which would be used in the routine eg a row number.
OnTime requires that the subroutine to be run is given as a string. I have tried every which way to construct a string that contains all the parameters without success. If "A1" contains '09:00 and "B2" contains 1 on sheet xyz
then Application.OnTime EarliestTime:=TimeValue("17:00:00"), Procedure:="my_Procedure "& cstr(sheets("xyz").cells(1,1)) &" "& cstr(sheets("xyz").cells(1,2)) should be running the equivalent of my_procedure 09:00 1. But I can't get it to work. So is it at all possible to pass parameters in such a case?
I have subroutine which takes one or more parameters - one being the same time that an ontime event triggers eg
sub mysub(active as date, lRow as long)
code
end sub
I need the ontime event to run the subroutine say 10 times a day at hourly intervals, each time checking the time until a certain time has been reached, then not call it again until the same start time every day. because I want to run effectively, the same routine every hour, it would be good if I could call one routine and pass parameters to it including the time it runs and and integer which would be used in the routine eg a row number.
OnTime requires that the subroutine to be run is given as a string. I have tried every which way to construct a string that contains all the parameters without success. If "A1" contains '09:00 and "B2" contains 1 on sheet xyz
then Application.OnTime EarliestTime:=TimeValue("17:00:00"), Procedure:="my_Procedure "& cstr(sheets("xyz").cells(1,1)) &" "& cstr(sheets("xyz").cells(1,2)) should be running the equivalent of my_procedure 09:00 1. But I can't get it to work. So is it at all possible to pass parameters in such a case?