Thread
:
On Time Bug?
View Single Post
#
10
Posted to microsoft.public.excel.misc
Antonio
Posts: n/a
On Time Bug?
All the PCs tested were using my spreadsheets.
Could you email me your spreadsheets to test on my system?
If you give me your email I will post my files to you.
Thanks,
Antonio
"Dave Peterson" wrote:
Positive.
Antonio wrote:
Hi Dave again,
I have tried the code in different computers and they all show the same
problem, the workbook reopens by itself.
I have tried one of my PCs with Microsoft Excel 2007 Beta 2. NIS 2006
installed
I have tried a different one with Office 2003, no NIS
I have tried two others, same issue.
Are you sure it does not refire on your PC?
Thanks,
Antonio
"Dave Peterson" wrote:
Nope.
But good luck in your quest.
Please post back if you or Norton resolve it. Then google will have for the
next person.
Antonio wrote:
Hi Dave,
Are you running Norton Internet Security 2006 by any chance?
Thanks,
Antonio
"Dave Peterson" wrote:
Ps. I used xl2003, but I'm hoping that that isn't the problem.
Post your version and maybe someone can see if it is a bug in that version of
excel using the simplified code.
Dave Peterson wrote:
I put your code into a a workbook called booktimer.xls:
In the thisworkbook module:
Option Explicit
Public Sub Workbook_Open()
timer
End Sub
Public Sub Workbook_BeforeClose(cancel As Boolean)
cancel_timer
End Sub
In a general module:
Option Explicit
Public rt As Double
Public Sub timer()
rt = Now + TimeValue("00:00:03")
ThisWorkbook.Worksheets(1).Range("a1").Value = rt
MsgBox "hi from Timer"
Application.OnTime rt, "timer"
End Sub
Public Sub cancel_timer()
Application.OnTime rt, "timer", , False
End Sub
I changed to every 3 seconds for testing. And I fully qualified the range.
But neither of those are important.
I put this in a general module of a different workbook:
Option Explicit
Sub testme()
Workbooks("booktimer.xls").Close False
End Sub
It worked fine.
If you build two small workbooks with nothing else in them, does it work?
And one more debugging hint:
Public Sub cancel_timer()
MsgBox rt & vbLf & ThisWorkbook.Worksheets(1).Range("a1")
Application.OnTime rt, "timer", , False
End Sub
Is there anything in your code that is resetting the rt variable?
Do you have End (not End if/End sub/end function) in your code in the workbook
with the timer code?
Did you reset the code (Run|Reset inside the VBE)?
I don't have a guess, but maybe if you build those test workbooks, you'll see
that your skinnied down code actually works--and if you find that, you're going
to be busy debugging.
Antonio wrote:
Please help me with this one. Sorry to go over this again.
ttb.xls:
ThisWorkbook:
Option Explicit
Public Sub Workbook_Open()
timer
End Sub
Public Sub Workbook_BeforeClose(cancel As Boolean) 'was Private Sub.... before
cancel_timer
End Sub
Module1
Option Explicit
Public rt As Double
Public Sub timer()
rt = Now + TimeValue("00:00:10")
Range("a1") = rt
Application.OnTime rt, "timer"
End Sub
Public Sub cancel_timer()
Application.OnTime rt, "timer", , False
End Sub
The above works fine. Beforeclose cancels the timer.
However, try to close ttb.xls from tta.xls using:
Sub main()
Workbooks("ttb.xls").Close SaveChanges:=False
End Sub
You will see that it gives you no error, closes ttb.xls. BUT ttb.xls reopens
again shortly after.
Please tell me I am missing something, I hope it is not a bug.
After substantial time and extra work to circunvent this I want to get to
the bottom of the issue.
Many thanks,
Antonio
--
Dave Peterson
--
Dave Peterson
--
Dave Peterson
--
Dave Peterson
Reply With Quote