Hello,
I have an issue with my auto-save macro on every 2minutes. It was working ok for couple of days, but now it is behaving odd.
Macro is as follows (in Module1):
This will save the file once it is run... In workbook module, I have:
What is happening is that, once this workbook is closed, it seems that the autosave macro is still running in the background, and 2minutes later, it will auto open the workbook (I assume to save it).
One thing which crosses my mind is just to change Call Module1.AutoDeactivate, but I don't see this as possible issue (at least I hope so)... I mean, since autosave macro is running in the background, seems it is not closed properly on close of my workbook...
Any advices?
Thanks in advance
pella88
I have an issue with my auto-save macro on every 2minutes. It was working ok for couple of days, but now it is behaving odd.
Macro is as follows (in Module1):
Code:
Public dTime As DateSub MyMacro()
Dim fPath As String
Application.DisplayAlerts = False
dTime = Now + TimeValue("00:02:00")
Application.OnTime dTime, "MyMacro"
fPath = ThisWorkbook.Path
ThisWorkbook.SaveAs Filename:=fPath & "\" & ThisWorkbook.Name
Application.DisplayAlerts = True
End Sub
Sub AutoDeactivate()
On Error Resume Next
Application.OnTime dTime, "MyMacro", , False
End Sub
This will save the file once it is run... In workbook module, I have:
Code:
Private Sub Workbook_Open()
Application.DisplayDocumentInformationPanel = False
Application.Visible = False: UserForm1.Show
Application.OnTime Now + TimeValue("00:02:00"), "MyMacro"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call AutoDeactivate
End Sub
What is happening is that, once this workbook is closed, it seems that the autosave macro is still running in the background, and 2minutes later, it will auto open the workbook (I assume to save it).
One thing which crosses my mind is just to change Call Module1.AutoDeactivate, but I don't see this as possible issue (at least I hope so)... I mean, since autosave macro is running in the background, seems it is not closed properly on close of my workbook...
Any advices?
Thanks in advance
pella88