Good morning happy campers.
I have the following codes set in a workbook.
This Workbook -
Private Sub WorkBook_Open()
Call GetSavesStarted
Call GetSaves_Started
End Sub
Private Sub WorkBook_BeforeClose(Cancel As Boolean)
If Executed = True Then Application.OnTime EarliestTime:=RunWhen, Procedure:=RunWhat, _
Schedule:=False
End Sub
Module 1
Public Wb As Workbook
Public RunWhen As Date
Public RunWhat As String
Public Executed As Boolean
Public Sub GetSavesStarted()
Set Wb = ThisWorkbook
RunWhat = "SaveThis"
Executed = True
Call SaveThis
End Sub
Public Sub SaveThis()
Application.DisplayAlerts = False
Wb.Save
Application.DisplayAlerts = True
RunWhen = Now + TimeValue("00:05:00")
Application.OnTime EarliestTime:=RunWhen, Procedure:=RunWhat, _
Schedule:=True
End Sub
Module 2
Public Wb As Workbook
Public RunWhen As Date
Public RunWhat As String
Public Executed As Boolean
Public Sub GetSaves_Started()
Set Wb = ThisWorkbook
RunWhat = "SaveMe"
Executed = True
Call SaveMe
End Sub
Public Sub SaveMe()
Application.DisplayAlerts = False
Wb.UpdateLink Name:=Wb.LinkSources
Application.DisplayAlerts = True
RunWhen = Now + TimeValue("00:00:30")
Application.OnTime EarliestTime:=RunWhen, Procedure:=RunWhat, _
Schedule:=True
End Sub
So far, when the work book is shared (allowing changes by more than one user) it appears to work fine, updating/refreshing the values every 30 seconds and then saving every 5 minutes.
The problem comes when closing the worksheet, i have the following error - "Complie Error: Ambigious name detected; ~"
Which highlights the following line in yellow -
Private Sub WorkBook_BeforeClose(Cancel As Boolean)
If i simply close the debugger then excel asks me if i want to save, i click yes, it saves and closes, job done.
What i would like to know is is the error going to casue me an issue, and either way, how do i prevent it?
I cant post work book yet as i would need to strip all data out of it, but the data inside the sheet is all manual entry with very few formula's, basically the code doesnt modify anything inside the sheet apart from updating values.
Kind Regards.
galvinpaddy
Bookmarks