Excel - EXCEL 2003 MACRO Problem

Asked By Neil Holden
17-Mar-10 08:34 AM
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"),
procedure:="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"),
End Sub
AcrFzh9U9533cbqeRHGWgdaoJVZr7A
(1)
Excel
(1)
Application.OnTime
(1)
Workbook
(1)
Macro
(1)
MimeOLE
(1)
SaveChanges
(1)
TimeValue
(1)
  Jan Karel Pieterse replied to Neil Holden
17-Mar-10 08:53 AM
Hi Neil,

You cannot schedule a macro that is placed in the thisworkbook module.

Move the sub your ontime method needs to fire to a normal module.

Also: do not call that sub Auto_close, this is a reserved name for a macro that
starts when the workbook is closed.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com


-------------------------------------------------
==========
microsoft/public.excel.misc #546592, from Neil_Holden, 1879 chars, Wed, 17 Mar
2010 05:34:01 -0700
----------
Thread-Topic: EXCEL 2003 MACRO Problem
thread-index: AcrFzh9U9533cbqeRHGWgdaoJVZr7A==
X-WBNR-Posting-Host: 217.45.250.225
Subject: EXCEL 2003 MACRO Problem
Date: Wed, 17 Mar 2010 05:34:01 -0700
Lines: 36
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325
Newsgroups: microsoft.public.excel.misc
X-VA-Origin: Zcisinet:microsoft/public.excel.misc


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"),
procedure:="ThisWorkbook.Auto_Close"
End Sub
Create New Account
help
How can I make my data show as flashing in Excel? Excel Excel Miscellaneous Discussions Microsoft Excel (1) Excel (1) Application.OnTime (1) Worksheet (1) Workbook (1) Macro (1) VBA (1) Font.ColorIndex (1) Don't bother if you insist, see Chip Pearson's site for VBA code. http: / / www.cpearson.com / excel / BlinkingText.aspx Gord Dibben MS Excel MVP This was great - thank you. My boss loved
Using application.ontime Excel Got this code in the workbook module. . . Had it working one moment, but now its at specific time, run the macro, and then close. (A)Anyone know the criteria surrounding "application.ontime" Does Excel have to be open? Does the workbook have to be open? (B) How do I effectively run the following code? Private Sub Workbook_Open() Application.OnTime TimeValue("13:38:00"), "Macro1" ActiveWorkbook.Close SaveChanges: = True End Sub Excel Programming Discussions Excel
application.ontime Excel Bonjour, je suis entrains de programmer une macro qui va excuter une autre macro = E0 pr = E9cise = E0 chaque jour sauf les fin de semaine. j'ai trouve un objet "application.ontime" mais malhereusement sa fonctionne pas voila mon code: public time as date sub test() time = 3D timevalue ("15:00:00 AM") application.ontime time, macro end sub sub macro msgbox "yeh!" end sub je ne comprend pas si il y a d'autre crit = E8res merci d'avance Excel - French Discussions TimeValue (1) Module (1) Macro (1) Date (1) Proc (1) VBA (1) Application
excel Excel excel Excel Discussions Excel (1) ExcelSalesAid (1) GuillettMicrosoft (1) SalesAid (1) Dguillett1 (1) I will certainly try to - - Don Guillett Microsoft MVP Excel SalesAid Software dguillett1@austin.rr.com keywords: excel description: excel