Pause Macro for a while and run the rest of the script later

E

Elton Law

Dear expert,
I recently try a new time macro. That is to back up the file at night time.
Then once I come back to office on next day, back-up has been finished
already.
Scripts are below ...
Open the file as of the path shown up in cell H3.
Activate the file windows called "Fixings", then save the file name as of
the file path in cell S2.
I have added "Calculate" many times in the scripts to make sure it reloads
all data before it saves ...
But ..............
I set at 3:30 am and save the file at 3.31 am.
To be honest, the file I opened is very large and usually takes 10 mins to
open, refresh data, etc .....
Look like "calculate" is not enough to refresh the data.
Is it possible to set a pause in macro ?
Say 15 mins .... then continue to run the ret of the scripts...
Thanks

************************

Windows("Openfile.XLS").Activate
Calculate
Workbooks.Open Filename:=Sheets("Sheet1").Range("H3").Value
Windows("Fixings.XLS").Activate
Calculate
Application.DisplayAlerts = False
Workbooks("Fixings.xls").SaveAs
Filename:=Workbooks("Openfile.xls").Sheets("Sheet1").Range("S2")
ActiveWorkbook.Close Savechanges:=True

************************
 
E

Elton Law

Wonderful ! Make it !!!!!!!!!!!!
Thanks a lot


AltaEgo said:
'start at 03:30
Application.Wait "03:30:00"
'do stuff
Application.Wait "03:45:00"
'do more stuff


Application.Wait "03:30:00"
'do stuff
'wit fifteen minutes after the code runs
Application.Wait(Now + TimeValue("0:15:00")) Then


For more information, see VBA help on wait.
 
N

news.eternal-september.org

Check out Application.AfterCalculate Event in Excel Help; might be what you
are looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top