Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have code to open a certain spreadsheet when opening the file:
Private Sub Workbook_Open() Worksheets("Main").Active MsgBox "This workbook will auto-close after 30 minutes of inactivity" Call SetTime End Sub But I also have code the start the timer to close on inactivity: Private Sub Workbook_Open() On Error Resume Next Application.OnTime RunWhen, "SaveAndClose", , False On Error GoTo 0 RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0) Application.OnTime RunWhen, "SaveAndClose", , True End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) On Error Resume Next Application.OnTime RunWhen, "SaveAndClose", , False On Error GoTo 0 End Sub Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) On Error Resume Next Application.OnTime RunWhen, "SaveAndClose", , False On Error GoTo 0 RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0) Application.OnTime RunWhen, "SaveAndClose", , True End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _ ByVal Target As Range) On Error Resume Next Application.OnTime RunWhen, "SaveAndClose", , False On Error GoTo 0 RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0) Application.OnTime RunWhen, "SaveAndClose", , True End Sub I am getting an ambigous error. I think it's because I have the Private Sub Workbook_Open() in each. Can anyone tell me what to do with this? Laurie |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conflicting Calculations | Excel Discussion (Misc queries) | |||
Conflicting vlookups | Excel Worksheet Functions | |||
Conflicting VBA's | Excel Programming | |||
Conflicting Code? | Excel Programming | |||
Conflicting VB Code | Excel Programming |