Hi all,
I have a shared workbook which I would like my collegues to keep open at all times, and they can add information to it via a userform.
In order to ensure there aren't any data clashes, they have to "refresh" the sheet before adding which uses this simple code:
I would like the sheet to automatically reopen itself for certain collegues every hour, effectively refreshing itself. I am trying to use the Workbook_Open method:
This works when the sheet is first opened, but doesnt run when is is opened again either via Refresh.
Please let me know if anything needs to be clarified. Any help is much appreciated!
I have a shared workbook which I would like my collegues to keep open at all times, and they can add information to it via a userform.
In order to ensure there aren't any data clashes, they have to "refresh" the sheet before adding which uses this simple code:
Code:
Sub Refresh()
On Error Resume Next
Application.OnTime earliesttime:=RefreshTime, procedure:="ReOpen", schedule:=False
On Error GoTo 0
Application.DisplayAlerts = False
Workbooks.Open Workbooks("MyFile").FullName
Application.DisplayAlerts = True
End Sub
I would like the sheet to automatically reopen itself for certain collegues every hour, effectively refreshing itself. I am trying to use the Workbook_Open method:
Code:
Public Sub Workbook_Open()
If Application.UserName = "List of names" Then
RefreshTime = Now + TimeValue("01:00:00")
Application.OnTime RefreshTime, "ReOpen"
End If
End Sub
Sub ReOpen()
If IsUserFormLoaded("AddInfoForm") = False Then
Application.DisplayAlerts = False
Workbooks.Open Workbooks("MyFile").FullName
Application.DisplayAlerts = True
End If
End Sub
This works when the sheet is first opened, but doesnt run when is is opened again either via Refresh.
Please let me know if anything needs to be clarified. Any help is much appreciated!