View Single Post
 
Old 10-05-2024, 04:24 AM
syl3786 syl3786 is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by Logit View Post
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
Thank you so much for your help!
Reply With Quote