Running Macros at a pre-set time
Running Macros at a pre-set time
(OP)
Hi Can anyone help. I want to run a macro at 6.00am every morning, is there a way of doing this?
I also want the macro to copy data to a networked workbook which will be read only, but it only works if the worksheet is open on my PC and then I have to save it and close for it to be available on the network, what am I doing wrong?
Any help would be greatly appreciated, please use laymens terms, I'm only a simple engineer!
Regards
Darren.
I also want the macro to copy data to a networked workbook which will be read only, but it only works if the worksheet is open on my PC and then I have to save it and close for it to be available on the network, what am I doing wrong?
Any help would be greatly appreciated, please use laymens terms, I'm only a simple engineer!
Regards
Darren.





RE: Running Macros at a pre-set time
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Running Macros at a pre-set time
RE: Running Macros at a pre-set time
For example the following code executes the macro test in the ThisWorkbook code module of the book1 workbook at 6:00am
Application.OnTime TimeValue("6:00 AM"),_
"D:excel\book1.xls!ThisWorkbook.test"
best regards
RE: Running Macros at a pre-set time
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Running Macros at a pre-set time
The workbook will be open all of the time anyway, I'm interfacing with a PLC draging the data from I/O, data reg's and counters at 1 min intervals so that's not a problem.
Finnigan, does the string go above the macro in the VB editer? if not where do I insert the initiation string
Have I got to allocate a cell to the 'now' time function?
Thanks again for your help
Darren. (Chamberlin)
RE: Running Macros at a pre-set time
RE: Running Macros at a pre-set time
RE: Running Macros at a pre-set time
Sub ontime()
Application.OnTime TimeValue("6:00:00"), "Test"
End sub
Sub Test()
Range("A1").Value = 10
End Sub
I presume you want to run the macro at 6:00AM automatically because no one is there to initiate it manually, if this is the case you would have to set the "ontime" macro running say, the night before and then at 6:00AM the number 10 would be inserted into the Active workbook for example.
Best regards
RE: Running Macros at a pre-set time
Is there a way of putting the macro in a loop so I don't have to start it every day, so it will run a 6am every morning regardless of starting it the day before?
If not its not a big deal just getting this far will save a lot of work.
thanks again for all of your help
Darren
RE: Running Macros at a pre-set time
Sub Test()
Range("A1").Value = 10
Application.OnTime TimeValue("6:00:00"), "Test"
End Sub
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.