Hi guys,
Background: I have created an excel file which allows my collegues to input various bits of news, and wanted to make it as simple to use, with restrictions, so use a userform. I also wanted them all to be able to keep it open, so made it a shared document.
In order to get around the problem of overwriting each others work i have a simple "Refresh" macro which simply reopens the file (upon adding data with the userform it saves the file).
I would now like to be able to have the file "refresh" itself automatically every 30 minutes.
My attempt:
Everything seems to work fine, except that the worksheet refreshes once, and then doesnt seem to actually Call ReRefresh
Any help would be much appreciated!
Thanks!
Background: I have created an excel file which allows my collegues to input various bits of news, and wanted to make it as simple to use, with restrictions, so use a userform. I also wanted them all to be able to keep it open, so made it a shared document.
In order to get around the problem of overwriting each others work i have a simple "Refresh" macro which simply reopens the file (upon adding data with the userform it saves the file).
Code:
Sub Refresh()
If IsUserFormLoaded("AddInfoForm") Then ' Stop refresh if userform is open
Call ReRefresh
Else
Application.DisplayAlerts = False
Workbooks.Open ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
Application.DisplayAlerts = True
End If
'function to see if userform is open
Function IsUserFormLoaded(ByVal UFName As String) As Boolean
Dim UForm As Object
IsUserFormLoaded = False
For Each UForm In VBA.UserForms
If UForm.Name = UFName Then
IsUserFormLoaded = True
Exit For
End If
Next
End Function
I would now like to be able to have the file "refresh" itself automatically every 30 minutes.
My attempt:
Code:
Private Sub Workbook_Open()
Call ReRefresh
End Sub
Sub ReRefresh()
Application.OnTime Now + TimeValue("00:30:00"), "Refresh"
End Sub
Everything seems to work fine, except that the worksheet refreshes once, and then doesnt seem to actually Call ReRefresh
Any help would be much appreciated!
Thanks!