View Single Post
 
Old 10-03-2024, 06:45 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

The following works here. Paste into a Regular Module. When the workbook opens, the saving macro initiates. When the workbook closes, the macro stops.

Code:
Dim TimeToRun

Sub auto_open()
    Call ScheduleCopyPriceOver
End Sub

Sub ScheduleCopyPriceOver()
On Error Resume Next
    TimeToRun = Now + TimeValue("00:00:05")
    DoEvents
    Application.OnTime TimeToRun, "CopyPriceOver"
End Sub

Sub CopyPriceOver()
On Error Resume Next
    ThisWorkbook.Save
    Call ScheduleCopyPriceOver
End Sub

Sub auto_close()
    On Error Resume Next
    Application.DisplayAlerts = True
    Application.OnTime TimeToRun, "CopyPriceOver", , False
End Sub
Reply With Quote