View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Neil Holden Neil Holden is offline
external usenet poster
 
Posts: 163
Default EXCEL 2003 MACRO Problem

Hi all gurus please help.

I have a windows schelduler to open at a certain time and when the cells
have been updated the file closes.

The problems i'm having it the file stays open and i have to manually close
the open file on a weekly basis, the cells are not updated either?

Please see my code below:


Private Changed As Boolean
Private Sub Workbook_Open()
'start with the workbook showing unchanged
Changed = False
' create our shutdown timer
Application.OnTime Now + TimeValue("00:00:10"),
procedu="ThisWorkbook.Auto_Close"
End Sub


Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Source As Range)
'if something is changed then restart the timer
Changed = True
End Sub
Private Sub Auto_Close()
'if no changes detected then save and close
If Changed = False Then
ThisWorkbook.Close SaveChanges:=True
End If
Changed = False
'cancel the timer
Call Application.OnTime(Now + TimeValue("00:00:15"),
"ThisWorkbook.Auto_Close")
End Sub