Hi Guys,
I have the following two pieces im trying to stich together with no luck, they work fine on there own but not together.
one is to force people to enable Macro's to unhide everything, and the second is a inactive kick out timer.
'Force enable Macro's'
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Sheets("START").Visible = xlVeryHidden
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
Sheets("START").Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "START" Then
ws.Visible = xlVeryHidden
End If
Next ws
ActiveWorkbook.Save
End Sub
-------------------------------
'Inactive kick out'
Dim DownTime As Date
--------------------------------
Sub SetTime()
DownTime = Now + TimeValue("00:10:00")
Application.OnTime DownTime, "ShutDown"
End Sub
--------------------------------
Sub ShutDown()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
--------------------------------
Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=DownTime, Procedure:="ShutDown", _
Schedule:=False
End Sub
Thanks
Jon
Bookmarks