Hi ,
I've been trying for the past hours to try to combine 2 Macros that I want to incorporate into an excel file.
Code
Dim xTime As String
Dim xWB As Workbook
Private Sub Workbook_Open()
'Updated by Extendoffice 2019/1/20
On Error Resume Next
xTime = Application.InputBox("Please specify the idle time:", "Save and Close After Idle Time", "00:10:00", , , , , 2)
Set xWB = ActiveWorkbook
If xTime = "" Then Exit Sub
Reset
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error Resume Next
If xTime = "" Then Exit Sub
Reset
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
If xTime = "" Then Exit Sub
Reset
End Sub
Sub Reset()
Static xCloseTime
If xCloseTime <> 0 Then
ActiveWorkbook.Application.OnTime xCloseTime, "SaveWork1", , False
End If
xCloseTime = Now + TimeValue(xTime)
ActiveWorkbook.Application.OnTime xCloseTime, "SaveWork1", , True
End Sub
AND
Private Sub Workbook_Open()
Worksheets("INSTRUCTIONS").Activate
End Sub
Display More
I seem to be having no luck moving stuff around and am very new to this whole Macro thing. The two codes basically close the Excel after 10 minutes and then have the excel open on a specific sheet.
Thanks in advance for anyone's help :),
Derek