JumboCactuar
Well-known Member
- Joined
- Nov 16, 2016
- Messages
- 788
- Office Version
- 365
- Platform
- Windows
Hi,
i have the following code which works great with just the one open workbook. But it runs into problems if other excel workbooks are open
i know i have to declare WB somewhere, maybe on open? so it stores in memory. I cant declare in autosave() as when it runs it will use the current active workbook
any help appreciated
i have the following code which works great with just the one open workbook. But it runs into problems if other excel workbooks are open
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.OnTime dTime, "autoSave", False
End Sub
Private Sub Workbook_Open()
dTime = Now + TimeValue("00:01:00")
Application.OnTime dTime, "autoSave"
End Sub
Code:
Public dTime As DateSub autoSave()
dTime = Now + TimeValue("00:01:00")
Application.OnTime dTime, "autoSave"
ActiveWorkbook.Sheets("Sheet1").Range("A1") = Time()
ActiveWorkbook.Save
End Sub
i know i have to declare WB somewhere, maybe on open? so it stores in memory. I cant declare in autosave() as when it runs it will use the current active workbook
any help appreciated