ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   execute macro; save it and close using Application.OnTime (https://www.excelbanter.com/excel-programming/360978-execute-macro%3B-save-close-using-application-ontime.html)

ina

execute macro; save it and close using Application.OnTime
 
hello,

I would like to know how to save after than the macro is finished to
run; for example I have this piece of code:


......
dtmTime = Now + TimeValue("00:00:07")
Application.OnTime dtmTime, "thisworkbook.operations"


Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\test.xls", FileFormat:=xlHtml, ReadOnlyRecommended:=False,
CreateBackup:=False
Application.DisplayAlerts = True
'and there how to determinate the exact time of the end of my macro; do
you think I have the
'possibility to catch it with something else than now ().
'my macro is a little slow as need to do a lot of calculation

dtmSave = dtmTime + TimeValue("00:01:00")
Application.OnTime dtmSave, "Save_Exit"

ina


ina

execute macro; save it and close using Application.OnTime
 
Thank you very much for this help.



All times are GMT +1. The time now is 06:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com